Skip to content

Commit

Permalink
refactor(structure): move CommentsEnabledContext to singeltons
Browse files Browse the repository at this point in the history
  • Loading branch information
binoy14 committed Apr 29, 2024
1 parent 94950b7 commit 8780274
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/sanity/src/_singletons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export * from './store/_legacy/ResourceCacheContext'
export * from './structure/comments/authoring-path/CommentsAuthoringPathContext'
export * from './structure/comments/CommentsContext'
export * from './structure/comments/components/pte/comment-input/CommentInputContext'
export * from './structure/comments/enabled/CommentsEnabledContext'
export * from './structure/components/pane/PaneContext'
export * from './structure/panes/document/DocumentPaneContext'
export * from './structure/StructureToolContext'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {createContext} from 'react'

import {CommentsEnabledContextValue} from '../../../../core/comments/context/enabled/types'

/**
* @internal
*/
export const CommentsEnabledContext = createContext<CommentsEnabledContextValue | null>(null)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {memo, type ReactNode} from 'react'
import {CommentsEnabledContext} from 'sanity/_singletons'

import {useResolveCommentsEnabled} from '../../hooks'
import {CommentsEnabledContext} from './CommentsEnabledContext'

interface CommentsEnabledProviderProps {
children: ReactNode
Expand Down
1 change: 0 additions & 1 deletion packages/sanity/src/core/comments/context/enabled/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './CommentsEnabledContext'
export * from './CommentsEnabledProvider'
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useContext} from 'react'
import {CommentsEnabledContext} from 'sanity/_singletons'

import {CommentsEnabledContext} from '../context/enabled'
import {type CommentsEnabledContextValue} from '../context/enabled/types'

/**
Expand Down

0 comments on commit 8780274

Please sign in to comment.