Skip to content

Commit

Permalink
refactor(tasks): move TasksEnabledContext to singletons
Browse files Browse the repository at this point in the history
  • Loading branch information
binoy14 committed Apr 29, 2024
1 parent ab835d9 commit 453d260
Show file tree
Hide file tree
Showing 5 changed files with 12 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 @@ -51,4 +51,5 @@ export * from './studio/router/RouterHistoryContext'
export * from './studio/SourceContext'
export * from './studio/WorkspaceContext'
export * from './studio/workspaces/WorkspacesContext'
export * from './tasks/enabled/TasksEnabledContext'
export * from './user-color/UserColorManagerContext'
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {createContext} from 'react'

import {TasksEnabledContextValue} from '../../../core/tasks/context/enabled/types'

/**
* @internal
*/
export const TasksEnabledContext = createContext<TasksEnabledContextValue | null>(null)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {useMemo} from 'react'

import {useFeatureEnabled} from '../../../hooks'
import {useWorkspace} from '../../../studio'
import {TasksEnabledContext} from './TasksEnabledContext'
import {TasksEnabledContext} from 'sanity/_singletons'

import {type TasksEnabledContextValue} from './types'

interface TaksEnabledProviderProps {
Expand Down
1 change: 0 additions & 1 deletion packages/sanity/src/core/tasks/context/enabled/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './TasksEnabledContext'
export * from './TasksEnabledProvider'
export * from './types'
export * from './useTasksEnabled'
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {useContext} from 'react'
import {TasksEnabledContext} from 'sanity/_singletons'

import {TasksEnabledContext} from './TasksEnabledContext'
import {type TasksEnabledContextValue} from './types'

/**
Expand Down

0 comments on commit 453d260

Please sign in to comment.