diff options
author | Samuel Newman <mozzius@protonmail.com> | 2025-08-14 01:12:31 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-14 01:12:31 +0300 |
commit | b2c56cbd6dfa9af576f947dd41a0d33376b184d1 (patch) | |
tree | acdf57b6e7e2860c89b20b1dc239fe20521cb1c4 /src/state/shell | |
parent | 275fece3e3de0bd09377a33813bcfe35e352874b (diff) | |
download | voidsky-b2c56cbd6dfa9af576f947dd41a0d33376b184d1.tar.zst |
Add displayName to contexts (#8814)
Diffstat (limited to 'src/state/shell')
-rw-r--r-- | src/state/shell/color-mode.tsx | 2 | ||||
-rw-r--r-- | src/state/shell/composer/index.tsx | 2 | ||||
-rw-r--r-- | src/state/shell/drawer-open.tsx | 2 | ||||
-rw-r--r-- | src/state/shell/drawer-swipe-disabled.tsx | 2 | ||||
-rw-r--r-- | src/state/shell/logged-out.tsx | 2 | ||||
-rw-r--r-- | src/state/shell/minimal-mode.tsx | 8 | ||||
-rw-r--r-- | src/state/shell/onboarding.tsx | 2 | ||||
-rw-r--r-- | src/state/shell/post-progress.tsx | 1 | ||||
-rw-r--r-- | src/state/shell/progress-guide.tsx | 4 | ||||
-rw-r--r-- | src/state/shell/selected-feed.tsx | 4 | ||||
-rw-r--r-- | src/state/shell/shell-layout.tsx | 3 | ||||
-rw-r--r-- | src/state/shell/starter-pack.tsx | 2 | ||||
-rw-r--r-- | src/state/shell/tick-every-minute.tsx | 1 |
13 files changed, 31 insertions, 4 deletions
diff --git a/src/state/shell/color-mode.tsx b/src/state/shell/color-mode.tsx index 47b936c0b..14495f06d 100644 --- a/src/state/shell/color-mode.tsx +++ b/src/state/shell/color-mode.tsx @@ -15,7 +15,9 @@ const stateContext = React.createContext<StateContext>({ colorMode: 'system', darkTheme: 'dark', }) +stateContext.displayName = 'ColorModeStateContext' const setContext = React.createContext<SetContext>({} as SetContext) +setContext.displayName = 'ColorModeSetContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [colorMode, setColorMode] = React.useState(persisted.get('colorMode')) diff --git a/src/state/shell/composer/index.tsx b/src/state/shell/composer/index.tsx index b31794248..ab73298ab 100644 --- a/src/state/shell/composer/index.tsx +++ b/src/state/shell/composer/index.tsx @@ -51,12 +51,14 @@ type ControlsContext = { } const stateContext = React.createContext<StateContext>(undefined) +stateContext.displayName = 'ComposerStateContext' const controlsContext = React.createContext<ControlsContext>({ openComposer(_opts: ComposerOpts) {}, closeComposer() { return false }, }) +controlsContext.displayName = 'ComposerControlsContext' export function Provider({children}: React.PropsWithChildren<{}>) { const {_} = useLingui() diff --git a/src/state/shell/drawer-open.tsx b/src/state/shell/drawer-open.tsx index 061ff53d7..87650a09c 100644 --- a/src/state/shell/drawer-open.tsx +++ b/src/state/shell/drawer-open.tsx @@ -4,7 +4,9 @@ type StateContext = boolean type SetContext = (v: boolean) => void const stateContext = React.createContext<StateContext>(false) +stateContext.displayName = 'DrawerOpenStateContext' const setContext = React.createContext<SetContext>((_: boolean) => {}) +setContext.displayName = 'DrawerOpenSetContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [state, setState] = React.useState(false) diff --git a/src/state/shell/drawer-swipe-disabled.tsx b/src/state/shell/drawer-swipe-disabled.tsx index d3f09f2a8..4b72639a2 100644 --- a/src/state/shell/drawer-swipe-disabled.tsx +++ b/src/state/shell/drawer-swipe-disabled.tsx @@ -4,7 +4,9 @@ type StateContext = boolean type SetContext = (v: boolean) => void const stateContext = React.createContext<StateContext>(false) +stateContext.displayName = 'DrawerSwipeDisabledStateContext' const setContext = React.createContext<SetContext>((_: boolean) => {}) +setContext.displayName = 'DrawerSwipeDisabledSetContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [state, setState] = React.useState(false) diff --git a/src/state/shell/logged-out.tsx b/src/state/shell/logged-out.tsx index 66240f2c0..3617a1eca 100644 --- a/src/state/shell/logged-out.tsx +++ b/src/state/shell/logged-out.tsx @@ -39,12 +39,14 @@ const StateContext = React.createContext<State>({ showLoggedOut: false, requestedAccountSwitchTo: undefined, }) +StateContext.displayName = 'LoggedOutStateContext' const ControlsContext = React.createContext<Controls>({ setShowLoggedOut: () => {}, requestSwitchToAccount: () => {}, clearRequestedAccount: () => {}, }) +ControlsContext.displayName = 'LoggedOutControlsContext' export function Provider({children}: React.PropsWithChildren<{}>) { const activeStarterPack = useActiveStarterPack() diff --git a/src/state/shell/minimal-mode.tsx b/src/state/shell/minimal-mode.tsx index eba3aa2b0..93eb47028 100644 --- a/src/state/shell/minimal-mode.tsx +++ b/src/state/shell/minimal-mode.tsx @@ -1,5 +1,9 @@ import React from 'react' -import {SharedValue, useSharedValue, withSpring} from 'react-native-reanimated' +import { + type SharedValue, + useSharedValue, + withSpring, +} from 'react-native-reanimated' type StateContext = { headerMode: SharedValue<number> @@ -29,7 +33,9 @@ const stateContext = React.createContext<StateContext>({ set() {}, }, }) +stateContext.displayName = 'MinimalModeStateContext' const setContext = React.createContext<SetContext>((_: boolean) => {}) +setContext.displayName = 'MinimalModeSetContext' export function Provider({children}: React.PropsWithChildren<{}>) { const headerMode = useSharedValue(0) diff --git a/src/state/shell/onboarding.tsx b/src/state/shell/onboarding.tsx index 9aad9953d..6b48f72ad 100644 --- a/src/state/shell/onboarding.tsx +++ b/src/state/shell/onboarding.tsx @@ -29,7 +29,9 @@ export type DispatchContext = (action: Action) => void const stateContext = React.createContext<StateContext>( compute(persisted.defaults.onboarding), ) +stateContext.displayName = 'OnboardingStateContext' const dispatchContext = React.createContext<DispatchContext>((_: Action) => {}) +dispatchContext.displayName = 'OnboardingDispatchContext' function reducer(state: StateContext, action: Action): StateContext { switch (action.type) { diff --git a/src/state/shell/post-progress.tsx b/src/state/shell/post-progress.tsx index 0df2a6be4..3c91c1607 100644 --- a/src/state/shell/post-progress.tsx +++ b/src/state/shell/post-progress.tsx @@ -10,6 +10,7 @@ const PostProgressContext = React.createContext<PostProgressState>({ progress: 0, status: 'idle', }) +PostProgressContext.displayName = 'PostProgressContext' export function Provider() {} diff --git a/src/state/shell/progress-guide.tsx b/src/state/shell/progress-guide.tsx index 19687267c..fa60f6ca7 100644 --- a/src/state/shell/progress-guide.tsx +++ b/src/state/shell/progress-guide.tsx @@ -5,7 +5,7 @@ import {useLingui} from '@lingui/react' import {logEvent} from '#/lib/statsig/statsig' import { ProgressGuideToast, - ProgressGuideToastRef, + type ProgressGuideToastRef, } from '#/components/ProgressGuide/Toast' import { usePreferencesQuery, @@ -45,6 +45,7 @@ export type ProgressGuide = | undefined const ProgressGuideContext = React.createContext<ProgressGuide>(undefined) +ProgressGuideContext.displayName = 'ProgressGuideContext' const ProgressGuideControlContext = React.createContext<{ startProgressGuide(guide: ProgressGuideName): void @@ -55,6 +56,7 @@ const ProgressGuideControlContext = React.createContext<{ endProgressGuide: () => {}, captureAction: (_action: ProgressGuideAction, _count = 1) => {}, }) +ProgressGuideControlContext.displayName = 'ProgressGuideControlContext' export function useProgressGuide(guide: ProgressGuideName) { const ctx = React.useContext(ProgressGuideContext) diff --git a/src/state/shell/selected-feed.tsx b/src/state/shell/selected-feed.tsx index 08b7ba77c..1f7f7a9c6 100644 --- a/src/state/shell/selected-feed.tsx +++ b/src/state/shell/selected-feed.tsx @@ -2,13 +2,15 @@ import React from 'react' import {isWeb} from '#/platform/detection' import * as persisted from '#/state/persisted' -import {FeedDescriptor} from '#/state/queries/post-feed' +import {type FeedDescriptor} from '#/state/queries/post-feed' type StateContext = FeedDescriptor | null type SetContext = (v: FeedDescriptor) => void const stateContext = React.createContext<StateContext>(null) +stateContext.displayName = 'SelectedFeedStateContext' const setContext = React.createContext<SetContext>((_: string) => {}) +setContext.displayName = 'SelectedFeedSetContext' function getInitialFeed(): FeedDescriptor | null { if (isWeb) { diff --git a/src/state/shell/shell-layout.tsx b/src/state/shell/shell-layout.tsx index 39f69cfff..f23227bd2 100644 --- a/src/state/shell/shell-layout.tsx +++ b/src/state/shell/shell-layout.tsx @@ -1,5 +1,5 @@ import React from 'react' -import {SharedValue, useSharedValue} from 'react-native-reanimated' +import {type SharedValue, useSharedValue} from 'react-native-reanimated' type StateContext = { headerHeight: SharedValue<number> @@ -28,6 +28,7 @@ const stateContext = React.createContext<StateContext>({ set() {}, }, }) +stateContext.displayName = 'ShellLayoutContext' export function Provider({children}: React.PropsWithChildren<{}>) { const headerHeight = useSharedValue(0) diff --git a/src/state/shell/starter-pack.tsx b/src/state/shell/starter-pack.tsx index f564712f0..8da2bcc5c 100644 --- a/src/state/shell/starter-pack.tsx +++ b/src/state/shell/starter-pack.tsx @@ -9,7 +9,9 @@ type StateContext = type SetContext = (v: StateContext) => void const stateContext = React.createContext<StateContext>(undefined) +stateContext.displayName = 'ActiveStarterPackStateContext' const setContext = React.createContext<SetContext>((_: StateContext) => {}) +setContext.displayName = 'ActiveStarterPackSetContext' export function Provider({children}: {children: React.ReactNode}) { const [state, setState] = React.useState<StateContext>() diff --git a/src/state/shell/tick-every-minute.tsx b/src/state/shell/tick-every-minute.tsx index c37221c90..d4978470e 100644 --- a/src/state/shell/tick-every-minute.tsx +++ b/src/state/shell/tick-every-minute.tsx @@ -3,6 +3,7 @@ import React from 'react' type StateContext = number const stateContext = React.createContext<StateContext>(0) +stateContext.displayName = 'TickEveryMinuteContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [tick, setTick] = React.useState(Date.now()) |