Skip to content

Commit

Permalink
refactor(scheduled-publishing): move ScheduledPublishingEnabledContex…
Browse files Browse the repository at this point in the history
…t to singletons
  • Loading branch information
binoy14 committed Apr 29, 2024
1 parent dab96b5 commit 00fc838
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {createContext} from 'react'

import type {ScheduledPublishingEnabledContextValue} from '../../../../core/scheduledPublishing/tool/contexts/ScheduledPublishingEnabledProvider'

/**
* @internal
*/
export const ScheduledPublishingEnabledContext =
createContext<ScheduledPublishingEnabledContextValue | null>(null)
1 change: 1 addition & 0 deletions packages/sanity/src/_singletons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export * from './core/form/studio/ValidationContext'
export * from './core/i18n/LocaleContext'
export * from './core/presence/FormFieldPresenceContext'
export * from './core/schedulePublishing/DocumentActionPropsContext'
export * from './core/schedulePublishing/tool/ScheduledPublishingEnabledContext'
export * from './core/store/_legacy/ResourceCacheContext'
export * from './core/studio/activeWorkspaceMatcher/ActiveWorkspaceMatcherContext'
export * from './core/studio/addonDataset/AddonDatasetContext'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {createContext, useContext, useMemo} from 'react'
import {useContext, useMemo} from 'react'
import {ScheduledPublishingEnabledContext} from 'sanity/_singletons'

import {useFeatureEnabled} from '../../../hooks'
import {useWorkspace} from '../../../studio'
Expand All @@ -16,12 +17,6 @@ export type ScheduledPublishingEnabledContextValue =
mode: 'default' | 'upsell'
}

/**
* @internal
*/
export const ScheduledPublishingEnabledContext =
createContext<ScheduledPublishingEnabledContextValue | null>(null)

interface TaksEnabledProviderProps {
children: React.ReactNode
}
Expand Down

0 comments on commit 00fc838

Please sign in to comment.