diff options
89 files changed, 173 insertions, 28 deletions
diff --git a/__mocks__/@gorhom/bottom-sheet.tsx b/__mocks__/@gorhom/bottom-sheet.tsx index dae0d6551..87bbe7d3a 100644 --- a/__mocks__/@gorhom/bottom-sheet.tsx +++ b/__mocks__/@gorhom/bottom-sheet.tsx @@ -1,7 +1,8 @@ -import React, {ReactNode} from 'react' -import {View, ScrollView, Modal, FlatList, TextInput} from 'react-native' +import React, {type ReactNode} from 'react' +import {FlatList, Modal, ScrollView, TextInput, View} from 'react-native' const BottomSheetModalContext = React.createContext(null) +BottomSheetModalContext.displayName = 'BottomSheetModalContext' const BottomSheetModalProvider = (props: any) => { return <BottomSheetModalContext.Provider {...props} value={{}} /> @@ -47,13 +48,13 @@ export {useBottomSheetInternal} export {useBottomSheetDynamicSnapPoints} export { - BottomSheetModalProvider, BottomSheetBackdrop, + BottomSheetFlatList, + BottomSheetFooter, BottomSheetHandle, BottomSheetModal, - BottomSheetFooter, + BottomSheetModalProvider, BottomSheetScrollView, - BottomSheetFlatList, BottomSheetTextInput, } diff --git a/modules/bottom-sheet/src/BottomSheetPortal.tsx b/modules/bottom-sheet/src/BottomSheetPortal.tsx index 4d8ed57ff..e259a2862 100644 --- a/modules/bottom-sheet/src/BottomSheetPortal.tsx +++ b/modules/bottom-sheet/src/BottomSheetPortal.tsx @@ -5,6 +5,7 @@ import {createPortalGroup_INTERNAL} from './lib/Portal' type PortalContext = React.ElementType<{children: React.ReactNode}> export const Context = React.createContext({} as PortalContext) +Context.displayName = 'BottomSheetPortalContext' export const useBottomSheetPortal_INTERNAL = () => React.useContext(Context) diff --git a/modules/bottom-sheet/src/lib/Portal.tsx b/modules/bottom-sheet/src/lib/Portal.tsx index dd1bc4c13..4dad2d8d2 100644 --- a/modules/bottom-sheet/src/lib/Portal.tsx +++ b/modules/bottom-sheet/src/lib/Portal.tsx @@ -18,6 +18,7 @@ export function createPortalGroup_INTERNAL() { append: () => {}, remove: () => {}, }) + Context.displayName = 'BottomSheetPortalContext' function Provider(props: React.PropsWithChildren<{}>) { const map = React.useRef<ComponentMap>({}) diff --git a/src/alf/index.tsx b/src/alf/index.tsx index 5443669c7..bee8ed78c 100644 --- a/src/alf/index.tsx +++ b/src/alf/index.tsx @@ -8,9 +8,9 @@ import { setFontScale as persistFontScale, } from '#/alf/fonts' import {createThemes, defaultTheme} from '#/alf/themes' -import {Theme, ThemeName} from '#/alf/types' +import {type Theme, type ThemeName} from '#/alf/types' import {BLUE_HUE, GREEN_HUE, RED_HUE} from '#/alf/util/colorGeneration' -import {Device} from '#/storage' +import {type Device} from '#/storage' export {atoms} from '#/alf/atoms' export * from '#/alf/breakpoints' @@ -61,6 +61,7 @@ export const Context = React.createContext<Alf>({ }, flags: {}, }) +Context.displayName = 'AlfContext' export function ThemeProvider({ children, diff --git a/src/components/Admonition.tsx b/src/components/Admonition.tsx index cdb1f0b8b..ea6751955 100644 --- a/src/components/Admonition.tsx +++ b/src/components/Admonition.tsx @@ -23,6 +23,7 @@ type Context = { const Context = createContext<Context>({ type: 'info', }) +Context.displayName = 'AdmonitionContext' export function Icon() { const t = useTheme() diff --git a/src/components/Button.tsx b/src/components/Button.tsx index fd56a28cf..5a0f0c1c7 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -109,6 +109,7 @@ const Context = React.createContext<VariantProps & ButtonState>({ pressed: false, disabled: false, }) +Context.displayName = 'ButtonContext' export function useButtonContext() { return React.useContext(Context) diff --git a/src/components/ContextMenu/context.tsx b/src/components/ContextMenu/context.tsx index cecb6a18d..d09d3e452 100644 --- a/src/components/ContextMenu/context.tsx +++ b/src/components/ContextMenu/context.tsx @@ -7,10 +7,13 @@ import { } from '#/components/ContextMenu/types' export const Context = React.createContext<ContextType | null>(null) +Context.displayName = 'ContextMenuContext' export const MenuContext = React.createContext<MenuContextType | null>(null) +MenuContext.displayName = 'ContextMenuMenuContext' export const ItemContext = React.createContext<ItemContextType | null>(null) +ItemContext.displayName = 'ContextMenuItemContext' export function useContextMenuContext() { const context = React.useContext(Context) diff --git a/src/components/Dialog/context.ts b/src/components/Dialog/context.ts index 2ecf5ba61..1caa4eac8 100644 --- a/src/components/Dialog/context.ts +++ b/src/components/Dialog/context.ts @@ -23,6 +23,7 @@ export const Context = createContext<DialogContextProps>({ setDisableDrag: () => {}, isWithinDialog: false, }) +Context.displayName = 'DialogContext' export function useDialogContext() { return useContext(Context) diff --git a/src/components/Grid.tsx b/src/components/Grid.tsx index d424634de..2bfac8673 100644 --- a/src/components/Grid.tsx +++ b/src/components/Grid.tsx @@ -1,11 +1,12 @@ import {createContext, useContext, useMemo} from 'react' import {View} from 'react-native' -import {atoms as a, ViewStyleProp} from '#/alf' +import {atoms as a, type ViewStyleProp} from '#/alf' const Context = createContext({ gap: 0, }) +Context.displayName = 'GridContext' export function Row({ children, diff --git a/src/components/Layout/Header/index.tsx b/src/components/Layout/Header/index.tsx index d68f4bd1d..1a049a696 100644 --- a/src/components/Layout/Header/index.tsx +++ b/src/components/Layout/Header/index.tsx @@ -77,6 +77,7 @@ export function Outer({ } const AlignmentContext = createContext<'platform' | 'left'>('platform') +AlignmentContext.displayName = 'AlignmentContext' export function Content({ children, diff --git a/src/components/Layout/context.ts b/src/components/Layout/context.ts index 8e0c5445e..f3ee7d4e5 100644 --- a/src/components/Layout/context.ts +++ b/src/components/Layout/context.ts @@ -3,3 +3,4 @@ import React from 'react' export const ScrollbarOffsetContext = React.createContext({ isWithinOffsetView: false, }) +ScrollbarOffsetContext.displayName = 'ScrollbarOffsetContext' diff --git a/src/components/Menu/context.tsx b/src/components/Menu/context.tsx index 076bc8151..1c4a873b3 100644 --- a/src/components/Menu/context.tsx +++ b/src/components/Menu/context.tsx @@ -3,8 +3,10 @@ import React from 'react' import {type ContextType, type ItemContextType} from '#/components/Menu/types' export const Context = React.createContext<ContextType | null>(null) +Context.displayName = 'MenuContext' export const ItemContext = React.createContext<ItemContextType | null>(null) +ItemContext.displayName = 'MenuItemContext' export function useMenuContext() { const context = React.useContext(Context) diff --git a/src/components/PolicyUpdateOverlay/context.tsx b/src/components/PolicyUpdateOverlay/context.tsx index 4f6e56e21..abb058d3c 100644 --- a/src/components/PolicyUpdateOverlay/context.tsx +++ b/src/components/PolicyUpdateOverlay/context.tsx @@ -28,6 +28,7 @@ const Context = createContext<{ */ setIsReadyToShowOverlay: () => {}, }) +Context.displayName = 'PolicyUpdateOverlayContext' export function usePolicyUpdateContext() { const context = useContext(Context) diff --git a/src/components/Portal.tsx b/src/components/Portal.tsx index 4e03d6b08..b4bebce4d 100644 --- a/src/components/Portal.tsx +++ b/src/components/Portal.tsx @@ -28,6 +28,7 @@ export function createPortalGroup() { append: () => {}, remove: () => {}, }) + Context.displayName = 'PortalContext' function Provider(props: React.PropsWithChildren<{}>) { const map = useRef<ComponentMap>({}) diff --git a/src/components/Post/Embed/VideoEmbed/ActiveVideoWebContext.tsx b/src/components/Post/Embed/VideoEmbed/ActiveVideoWebContext.tsx index a038403b2..c6e0eec32 100644 --- a/src/components/Post/Embed/VideoEmbed/ActiveVideoWebContext.tsx +++ b/src/components/Post/Embed/VideoEmbed/ActiveVideoWebContext.tsx @@ -15,6 +15,7 @@ const Context = React.createContext<{ setActiveView: (viewId: string) => void sendViewPosition: (viewId: string, y: number) => void } | null>(null) +Context.displayName = 'ActiveVideoWebContext' export function Provider({children}: {children: React.ReactNode}) { if (!isWeb) { diff --git a/src/components/Post/Embed/VideoEmbed/VideoVolumeContext.tsx b/src/components/Post/Embed/VideoEmbed/VideoVolumeContext.tsx index 6343081da..7db5f9842 100644 --- a/src/components/Post/Embed/VideoEmbed/VideoVolumeContext.tsx +++ b/src/components/Post/Embed/VideoEmbed/VideoVolumeContext.tsx @@ -8,6 +8,7 @@ const Context = React.createContext<{ volume: number setVolume: React.Dispatch<React.SetStateAction<number>> } | null>(null) +Context.displayName = 'VideoVolumeContext' export function Provider({children}: {children: React.ReactNode}) { const [muted, setMuted] = React.useState(true) diff --git a/src/components/Post/Embed/VideoEmbed/index.web.tsx b/src/components/Post/Embed/VideoEmbed/index.web.tsx index 5bb54eef8..28341d826 100644 --- a/src/components/Post/Embed/VideoEmbed/index.web.tsx +++ b/src/components/Post/Embed/VideoEmbed/index.web.tsx @@ -125,6 +125,7 @@ export function VideoEmbed({ } const NearScreenContext = createContext(false) +NearScreenContext.displayName = 'VideoNearScreenContext' /** * Renders a 100vh tall div and watches it with an IntersectionObserver to diff --git a/src/components/PostControls/PostControlButton.tsx b/src/components/PostControls/PostControlButton.tsx index f41f95049..ae69b1322 100644 --- a/src/components/PostControls/PostControlButton.tsx +++ b/src/components/PostControls/PostControlButton.tsx @@ -13,6 +13,7 @@ const PostControlContext = createContext<{ active?: boolean color?: {color: string} }>({}) +PostControlContext.displayName = 'PostControlContext' // Base button style, which the the other ones extend export function PostControlButton({ diff --git a/src/components/Prompt.tsx b/src/components/Prompt.tsx index 2ff0c7ccc..626d8316d 100644 --- a/src/components/Prompt.tsx +++ b/src/components/Prompt.tsx @@ -27,6 +27,7 @@ const Context = React.createContext<{ titleId: '', descriptionId: '', }) +Context.displayName = 'PromptContext' export function Outer({ children, diff --git a/src/components/Select/index.tsx b/src/components/Select/index.tsx index 4e8e53216..82520f12a 100644 --- a/src/components/Select/index.tsx +++ b/src/components/Select/index.tsx @@ -34,10 +34,12 @@ type ContextType = { } & Pick<RootProps, 'value' | 'onValueChange' | 'disabled'> const Context = createContext<ContextType | null>(null) +Context.displayName = 'SelectContext' const ValueTextContext = createContext< [any, React.Dispatch<React.SetStateAction<any>>] >([undefined, () => {}]) +ValueTextContext.displayName = 'ValueTextContext' function useSelectContext() { const ctx = useContext(Context) @@ -229,6 +231,7 @@ const ItemContext = createContext<{ focused: false, pressed: false, }) +ItemContext.displayName = 'SelectItemContext' export function useItemContext() { return useContext(ItemContext) diff --git a/src/components/Select/index.web.tsx b/src/components/Select/index.web.tsx index 324148683..4e92d3c51 100644 --- a/src/components/Select/index.web.tsx +++ b/src/components/Select/index.web.tsx @@ -23,6 +23,7 @@ import { } from './types' const SelectedValueContext = createContext<string | undefined | null>(null) +SelectedValueContext.displayName = 'SelectSelectedValueContext' export function Root(props: RootProps) { return ( @@ -219,6 +220,7 @@ const ItemContext = createContext<{ pressed: false, selected: false, }) +ItemContext.displayName = 'SelectItemContext' export function useItemContext() { return useContext(ItemContext) diff --git a/src/components/Toast/Toast.tsx b/src/components/Toast/Toast.tsx index 2d1ea4261..908b470a4 100644 --- a/src/components/Toast/Toast.tsx +++ b/src/components/Toast/Toast.tsx @@ -24,6 +24,7 @@ export const ICONS = { const Context = createContext<ContextType>({ type: 'default', }) +Context.displayName = 'ToastContext' export function Toast({ type, diff --git a/src/components/Tooltip/index.tsx b/src/components/Tooltip/index.tsx index fbdb969db..a7d151020 100644 --- a/src/components/Tooltip/index.tsx +++ b/src/components/Tooltip/index.tsx @@ -53,12 +53,14 @@ const TooltipContext = createContext<TooltipContextType>({ visible: false, onVisibleChange: () => {}, }) +TooltipContext.displayName = 'TooltipContext' const TargetContext = createContext<TargetContextType>({ targetMeasurements: undefined, setTargetMeasurements: () => {}, shouldMeasure: false, }) +TargetContext.displayName = 'TargetContext' export function Outer({ children, diff --git a/src/components/Tooltip/index.web.tsx b/src/components/Tooltip/index.web.tsx index fc5808d7a..69b4cd338 100644 --- a/src/components/Tooltip/index.web.tsx +++ b/src/components/Tooltip/index.web.tsx @@ -20,6 +20,7 @@ const TooltipContext = createContext<TooltipContextType>({ position: 'bottom', onVisibleChange: () => {}, }) +TooltipContext.displayName = 'TooltipContext' export function Outer({ children, diff --git a/src/components/dialogs/Context.tsx b/src/components/dialogs/Context.tsx index 8c700cafe..bc802482f 100644 --- a/src/components/dialogs/Context.tsx +++ b/src/components/dialogs/Context.tsx @@ -27,6 +27,7 @@ type ControlsContext = { } const ControlsContext = createContext<ControlsContext | null>(null) +ControlsContext.displayName = 'GlobalDialogControlsContext' export function useGlobalDialogsControlContext() { const ctx = useContext(ControlsContext) diff --git a/src/components/dialogs/nuxs/index.tsx b/src/components/dialogs/nuxs/index.tsx index 5529893c0..2daf4a268 100644 --- a/src/components/dialogs/nuxs/index.tsx +++ b/src/components/dialogs/nuxs/index.tsx @@ -47,6 +47,7 @@ const Context = React.createContext<Context>({ activeNux: undefined, dismissActiveNux: () => {}, }) +Context.displayName = 'NuxDialogContext' export function useNuxDialogContext() { return React.useContext(Context) diff --git a/src/components/dms/MessageContext.tsx b/src/components/dms/MessageContext.tsx index 84056fb30..645079eb2 100644 --- a/src/components/dms/MessageContext.tsx +++ b/src/components/dms/MessageContext.tsx @@ -1,6 +1,7 @@ import React from 'react' const MessageContext = React.createContext(false) +MessageContext.displayName = 'MessageContext' export function MessageContextProvider({ children, diff --git a/src/components/forms/TextField.tsx b/src/components/forms/TextField.tsx index 3913c3283..9993317d6 100644 --- a/src/components/forms/TextField.tsx +++ b/src/components/forms/TextField.tsx @@ -46,6 +46,7 @@ const Context = createContext<{ onFocus: () => {}, onBlur: () => {}, }) +Context.displayName = 'TextFieldContext' export type RootProps = React.PropsWithChildren<{isInvalid?: boolean}> diff --git a/src/components/forms/Toggle.tsx b/src/components/forms/Toggle.tsx index 4e3695bbf..9c3564aa5 100644 --- a/src/components/forms/Toggle.tsx +++ b/src/components/forms/Toggle.tsx @@ -1,5 +1,5 @@ import React from 'react' -import {Pressable, View, ViewStyle} from 'react-native' +import {Pressable, View, type ViewStyle} from 'react-native' import Animated, {LinearTransition} from 'react-native-reanimated' import {HITSLOP_10} from '#/lib/constants' @@ -8,9 +8,9 @@ import { atoms as a, flatten, native, - TextStyleProp, + type TextStyleProp, useTheme, - ViewStyleProp, + type ViewStyleProp, } from '#/alf' import {useInteractionState} from '#/components/hooks/useInteractionState' import {CheckThick_Stroke2_Corner0_Rounded as Checkmark} from '#/components/icons/Check' @@ -35,6 +35,7 @@ const ItemContext = React.createContext<ItemState>({ pressed: false, focused: false, }) +ItemContext.displayName = 'ToggleItemContext' const GroupContext = React.createContext<{ values: string[] @@ -49,6 +50,7 @@ const GroupContext = React.createContext<{ maxSelectionsReached: false, setFieldValue: () => {}, }) +GroupContext.displayName = 'ToggleGroupContext' export type GroupProps = React.PropsWithChildren<{ type?: 'radio' | 'checkbox' diff --git a/src/components/intents/IntentDialogs.tsx b/src/components/intents/IntentDialogs.tsx index 244850370..40b227e49 100644 --- a/src/components/intents/IntentDialogs.tsx +++ b/src/components/intents/IntentDialogs.tsx @@ -1,7 +1,7 @@ import React from 'react' import * as Dialog from '#/components/Dialog' -import {DialogControlProps} from '#/components/Dialog' +import {type DialogControlProps} from '#/components/Dialog' import {VerifyEmailIntentDialog} from '#/components/intents/VerifyEmailIntentDialog' interface Context { @@ -11,6 +11,7 @@ interface Context { } const Context = React.createContext({} as Context) +Context.displayName = 'IntentDialogsContext' export const useIntentDialogs = () => React.useContext(Context) export function Provider({children}: {children: React.ReactNode}) { diff --git a/src/components/moderation/Hider.tsx b/src/components/moderation/Hider.tsx index 39f28b403..c6b332e43 100644 --- a/src/components/moderation/Hider.tsx +++ b/src/components/moderation/Hider.tsx @@ -1,8 +1,8 @@ import React from 'react' -import {ModerationUI} from '@atproto/api' +import {type ModerationUI} from '@atproto/api' import { - ModerationCauseDescription, + type ModerationCauseDescription, useModerationCauseDescription, } from '#/lib/moderation/useModerationCauseDescription' import { @@ -22,6 +22,7 @@ type Context = { } const Context = React.createContext<Context>({} as Context) +Context.displayName = 'HiderContext' export const useHider = () => React.useContext(Context) diff --git a/src/lib/ScrollContext.tsx b/src/lib/ScrollContext.tsx index d55b8cdab..7cab5236b 100644 --- a/src/lib/ScrollContext.tsx +++ b/src/lib/ScrollContext.tsx @@ -1,5 +1,5 @@ -import React, {createContext, useContext, useMemo} from 'react' -import {ScrollHandlers} from 'react-native-reanimated' +import {createContext, useContext, useMemo} from 'react' +import {type ScrollHandlers} from 'react-native-reanimated' const ScrollContext = createContext<ScrollHandlers<any>>({ onBeginDrag: undefined, @@ -7,6 +7,7 @@ const ScrollContext = createContext<ScrollHandlers<any>>({ onScroll: undefined, onMomentumEnd: undefined, }) +ScrollContext.displayName = 'ScrollContext' export function useScrollHandlers(): ScrollHandlers<any> { return useContext(ScrollContext) diff --git a/src/lib/ThemeContext.tsx b/src/lib/ThemeContext.tsx index c00d26606..9714d8e0e 100644 --- a/src/lib/ThemeContext.tsx +++ b/src/lib/ThemeContext.tsx @@ -89,6 +89,7 @@ export interface ThemeProviderProps { } export const ThemeContext = createContext<Theme>(defaultTheme) +ThemeContext.displayName = 'ThemeContext' export const useTheme = () => useContext(ThemeContext) diff --git a/src/lib/hooks/useEnableKeyboardController.tsx b/src/lib/hooks/useEnableKeyboardController.tsx index 858f6943a..5d9348bcd 100644 --- a/src/lib/hooks/useEnableKeyboardController.tsx +++ b/src/lib/hooks/useEnableKeyboardController.tsx @@ -19,6 +19,8 @@ const KeyboardControllerRefCountContext = createContext<{ incrementRefCount: () => {}, decrementRefCount: () => {}, }) +KeyboardControllerRefCountContext.displayName = + 'KeyboardControllerRefCountContext' export function KeyboardControllerProvider({ children, diff --git a/src/lib/hooks/useHideBottomBarBorder.tsx b/src/lib/hooks/useHideBottomBarBorder.tsx index e21184fda..6cbe9ad3d 100644 --- a/src/lib/hooks/useHideBottomBarBorder.tsx +++ b/src/lib/hooks/useHideBottomBarBorder.tsx @@ -4,8 +4,11 @@ import {useFocusEffect} from '@react-navigation/native' type HideBottomBarBorderSetter = () => () => void const HideBottomBarBorderContext = createContext<boolean>(false) +HideBottomBarBorderContext.displayName = 'HideBottomBarBorderContext' const HideBottomBarBorderSetterContext = createContext<HideBottomBarBorderSetter | null>(null) +HideBottomBarBorderSetterContext.displayName = + 'HideBottomBarBorderSetterContext' export function useHideBottomBarBorderSetter() { const hideBottomBarBorder = useContext(HideBottomBarBorderSetterContext) diff --git a/src/lib/statsig/statsig.tsx b/src/lib/statsig/statsig.tsx index 1091c82e0..860e841eb 100644 --- a/src/lib/statsig/statsig.tsx +++ b/src/lib/statsig/statsig.tsx @@ -147,6 +147,7 @@ function toStringRecord<E extends keyof MetricEvents>( // and it's been difficult to get it to behave in a predictable way. // Our own cache ensures consistent evaluation within a single session. const GateCache = React.createContext<Map<string, boolean> | null>(null) +GateCache.displayName = 'StatsigGateCacheContext' type GateOptions = { dangerouslyDisableExposureLogging?: boolean diff --git a/src/screens/Onboarding/StepProfile/index.tsx b/src/screens/Onboarding/StepProfile/index.tsx index 555507689..30da5cbb5 100644 --- a/src/screens/Onboarding/StepProfile/index.tsx +++ b/src/screens/Onboarding/StepProfile/index.tsx @@ -59,6 +59,7 @@ interface IAvatarContext { } const AvatarContext = React.createContext<IAvatarContext>({} as IAvatarContext) +AvatarContext.displayName = 'AvatarContext' export const useAvatar = () => React.useContext(AvatarContext) const randomColor = diff --git a/src/screens/Onboarding/state.ts b/src/screens/Onboarding/state.ts index 20d3ef217..cbb466245 100644 --- a/src/screens/Onboarding/state.ts +++ b/src/screens/Onboarding/state.ts @@ -3,7 +3,10 @@ import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import {logger} from '#/logger' -import {AvatarColor, Emoji} from '#/screens/Onboarding/StepProfile/types' +import { + type AvatarColor, + type Emoji, +} from '#/screens/Onboarding/StepProfile/types' export type OnboardingState = { hasPrev: boolean @@ -147,6 +150,7 @@ export const Context = React.createContext<{ state: {...initialState}, dispatch: () => {}, }) +Context.displayName = 'OnboardingContext' export function reducer( s: OnboardingState, diff --git a/src/screens/Settings/components/SettingsList.tsx b/src/screens/Settings/components/SettingsList.tsx index 572084972..dbf80d552 100644 --- a/src/screens/Settings/components/SettingsList.tsx +++ b/src/screens/Settings/components/SettingsList.tsx @@ -18,6 +18,7 @@ const ItemContext = createContext({ destructive: false, withinGroup: false, }) +ItemContext.displayName = 'SettingsListItemContext' const Portal = createPortalGroup() diff --git a/src/screens/Signup/state.ts b/src/screens/Signup/state.ts index 48ea4ccd9..29b27e7a2 100644 --- a/src/screens/Signup/state.ts +++ b/src/screens/Signup/state.ts @@ -246,6 +246,7 @@ interface IContext { dispatch: React.Dispatch<SignupAction> } export const SignupContext = React.createContext<IContext>({} as IContext) +SignupContext.displayName = 'SignupContext' export const useSignupContext = () => React.useContext(SignupContext) export function useSubmitSignup() { diff --git a/src/screens/StarterPack/Wizard/State.tsx b/src/screens/StarterPack/Wizard/State.tsx index 04901ee48..7fae8ca6d 100644 --- a/src/screens/StarterPack/Wizard/State.tsx +++ b/src/screens/StarterPack/Wizard/State.tsx @@ -45,6 +45,7 @@ const StateContext = React.createContext<TStateContext>([ {} as State, (_: Action) => {}, ]) +StateContext.displayName = 'StarterPackWizardStateContext' export const useWizardState = () => React.useContext(StateContext) function reducer(state: State, action: Action): State { diff --git a/src/state/a11y.tsx b/src/state/a11y.tsx index 08948267c..2182e39f0 100644 --- a/src/state/a11y.tsx +++ b/src/state/a11y.tsx @@ -8,6 +8,7 @@ const Context = React.createContext({ reduceMotionEnabled: false, screenReaderEnabled: false, }) +Context.displayName = 'A11yContext' export function useA11y() { return React.useContext(Context) diff --git a/src/state/ageAssurance/index.tsx b/src/state/ageAssurance/index.tsx index 6cdd8d929..23133046a 100644 --- a/src/state/ageAssurance/index.tsx +++ b/src/state/ageAssurance/index.tsx @@ -28,11 +28,13 @@ const AgeAssuranceContext = createContext<AgeAssuranceContextType>({ lastInitiatedAt: undefined, isAgeRestricted: false, }) +AgeAssuranceContext.displayName = 'AgeAssuranceContext' const AgeAssuranceAPIContext = createContext<AgeAssuranceAPIContextType>({ // @ts-ignore can't be bothered to type this refetch: () => Promise.resolve(), }) +AgeAssuranceAPIContext.displayName = 'AgeAssuranceAPIContext' /** * Low-level provider for fetching age assurance state on app load. Do not add diff --git a/src/state/cache/thread-mutes.tsx b/src/state/cache/thread-mutes.tsx index 4492977f2..42c3adfe2 100644 --- a/src/state/cache/thread-mutes.tsx +++ b/src/state/cache/thread-mutes.tsx @@ -7,9 +7,11 @@ type StateContext = Map<string, boolean> type SetStateContext = (uri: string, value: boolean) => void const stateContext = React.createContext<StateContext>(new Map()) +stateContext.displayName = 'ThreadMutesStateContext' const setStateContext = React.createContext<SetStateContext>( (_: string) => false, ) +setStateContext.displayName = 'ThreadMutesSetStateContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [state, setState] = React.useState<StateContext>(() => new Map()) diff --git a/src/state/dialogs/index.tsx b/src/state/dialogs/index.tsx index 520fb2c84..51ca8b514 100644 --- a/src/state/dialogs/index.tsx +++ b/src/state/dialogs/index.tsx @@ -26,10 +26,12 @@ interface IDialogControlContext { } const DialogContext = React.createContext<IDialogContext>({} as IDialogContext) +DialogContext.displayName = 'DialogContext' const DialogControlContext = React.createContext<IDialogControlContext>( {} as IDialogControlContext, ) +DialogControlContext.displayName = 'DialogControlContext' /** * The number of dialogs that are fully expanded. This is used to determine the background color of the status bar @@ -107,3 +109,4 @@ export function Provider({children}: React.PropsWithChildren<{}>) { </DialogContext.Provider> ) } +Provider.displayName = 'DialogsProvider' diff --git a/src/state/feed-feedback.tsx b/src/state/feed-feedback.tsx index a718a761d..ee381259d 100644 --- a/src/state/feed-feedback.tsx +++ b/src/state/feed-feedback.tsx @@ -35,6 +35,7 @@ const stateContext = createContext<StateContext>({ sendInteraction: (_interaction: AppBskyFeedDefs.Interaction) => {}, feedDescriptor: undefined, }) +stateContext.displayName = 'FeedFeedbackContext' export function useFeedFeedback( feed: FeedDescriptor | undefined, diff --git a/src/state/geolocation.tsx b/src/state/geolocation.tsx index 20b161ffe..4581996a0 100644 --- a/src/state/geolocation.tsx +++ b/src/state/geolocation.tsx @@ -154,6 +154,7 @@ type Context = { const context = React.createContext<Context>({ geolocation: DEFAULT_GEOLOCATION, }) +context.displayName = 'GeolocationContext' export function Provider({children}: {children: React.ReactNode}) { const [geolocation, setGeolocation] = React.useState(() => { diff --git a/src/state/global-gesture-events/index.tsx b/src/state/global-gesture-events/index.tsx index f8d87a8f9..8941d9ef4 100644 --- a/src/state/global-gesture-events/index.tsx +++ b/src/state/global-gesture-events/index.tsx @@ -25,6 +25,7 @@ const Context = createContext<{ register: () => {}, unregister: () => {}, }) +Context.displayName = 'GlobalGestureEventsContext' export function GlobalGestureEventsProvider({ children, diff --git a/src/state/home-badge.tsx b/src/state/home-badge.tsx index 59a9276ce..e1000b90b 100644 --- a/src/state/home-badge.tsx +++ b/src/state/home-badge.tsx @@ -4,7 +4,9 @@ type StateContext = boolean type ApiContext = (hasNew: boolean) => void const stateContext = React.createContext<StateContext>(false) +stateContext.displayName = 'HomeBadgeStateContext' const apiContext = React.createContext<ApiContext>((_: boolean) => {}) +apiContext.displayName = 'HomeBadgeApiContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [state, setState] = React.useState(false) diff --git a/src/state/invites.tsx b/src/state/invites.tsx index 0d40caf25..4f12cb12f 100644 --- a/src/state/invites.tsx +++ b/src/state/invites.tsx @@ -10,9 +10,11 @@ type ApiContext = { const stateContext = React.createContext<StateContext>( persisted.defaults.invites, ) +stateContext.displayName = 'InvitesStateContext' const apiContext = React.createContext<ApiContext>({ setInviteCopied(_: string) {}, }) +apiContext.displayName = 'InvitesApiContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [state, setState] = React.useState(persisted.get('invites')) diff --git a/src/state/lightbox.tsx b/src/state/lightbox.tsx index 3e01d7ef7..78145d5d7 100644 --- a/src/state/lightbox.tsx +++ b/src/state/lightbox.tsx @@ -2,7 +2,7 @@ import React from 'react' import {nanoid} from 'nanoid/non-secure' import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' -import {ImageSource} from '#/view/com/lightbox/ImageViewing/@types' +import {type ImageSource} from '#/view/com/lightbox/ImageViewing/@types' export type Lightbox = { id: string @@ -15,6 +15,7 @@ const LightboxContext = React.createContext<{ }>({ activeLightbox: null, }) +LightboxContext.displayName = 'LightboxContext' const LightboxControlContext = React.createContext<{ openLightbox: (lightbox: Omit<Lightbox, 'id'>) => void @@ -23,6 +24,7 @@ const LightboxControlContext = React.createContext<{ openLightbox: () => {}, closeLightbox: () => false, }) +LightboxControlContext.displayName = 'LightboxControlContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [activeLightbox, setActiveLightbox] = React.useState<Lightbox | null>( diff --git a/src/state/messages/convo/index.tsx b/src/state/messages/convo/index.tsx index a53f08900..d9ce19fdb 100644 --- a/src/state/messages/convo/index.tsx +++ b/src/state/messages/convo/index.tsx @@ -26,6 +26,7 @@ import {useAgent} from '#/state/session' export * from '#/state/messages/convo/util' const ChatContext = React.createContext<ConvoState | null>(null) +ChatContext.displayName = 'ChatContext' export function useConvo() { const ctx = useContext(ChatContext) diff --git a/src/state/messages/current-convo-id.tsx b/src/state/messages/current-convo-id.tsx index 69133a371..082f59919 100644 --- a/src/state/messages/current-convo-id.tsx +++ b/src/state/messages/current-convo-id.tsx @@ -7,6 +7,7 @@ const CurrentConvoIdContext = React.createContext<{ currentConvoId: undefined, setCurrentConvoId: () => {}, }) +CurrentConvoIdContext.displayName = 'CurrentConvoIdContext' export function useCurrentConvoId() { const ctx = React.useContext(CurrentConvoIdContext) diff --git a/src/state/messages/events/index.tsx b/src/state/messages/events/index.tsx index b3321df64..2ff0784ae 100644 --- a/src/state/messages/events/index.tsx +++ b/src/state/messages/events/index.tsx @@ -7,6 +7,7 @@ import {useAgent, useSession} from '#/state/session' const MessagesEventBusContext = React.createContext<MessagesEventBus | null>( null, ) +MessagesEventBusContext.displayName = 'MessagesEventBusContext' export function useMessagesEventBus() { const ctx = React.useContext(MessagesEventBusContext) diff --git a/src/state/messages/message-drafts.tsx b/src/state/messages/message-drafts.tsx index 132e85967..62521965b 100644 --- a/src/state/messages/message-drafts.tsx +++ b/src/state/messages/message-drafts.tsx @@ -6,6 +6,7 @@ const MessageDraftsContext = React.createContext<{ state: State dispatch: React.Dispatch<Actions> } | null>(null) +MessageDraftsContext.displayName = 'MessageDraftsContext' function useMessageDraftsContext() { const ctx = React.useContext(MessageDraftsContext) diff --git a/src/state/modals/index.tsx b/src/state/modals/index.tsx index 7b6f5d7b3..9197a66c9 100644 --- a/src/state/modals/index.tsx +++ b/src/state/modals/index.tsx @@ -70,6 +70,7 @@ const ModalContext = React.createContext<{ isModalActive: false, activeModals: [], }) +ModalContext.displayName = 'ModalContext' const ModalControlContext = React.createContext<{ openModal: (modal: Modal) => void @@ -80,6 +81,7 @@ const ModalControlContext = React.createContext<{ closeModal: () => false, closeAllModals: () => false, }) +ModalControlContext.displayName = 'ModalControlContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [activeModals, setActiveModals] = React.useState<Modal[]>([]) diff --git a/src/state/preferences/alt-text-required.tsx b/src/state/preferences/alt-text-required.tsx index 0ddc173ea..1e001752e 100644 --- a/src/state/preferences/alt-text-required.tsx +++ b/src/state/preferences/alt-text-required.tsx @@ -8,9 +8,11 @@ type SetContext = (v: persisted.Schema['requireAltTextEnabled']) => void const stateContext = React.createContext<StateContext>( persisted.defaults.requireAltTextEnabled, ) +stateContext.displayName = 'AltTextRequiredStateContext' const setContext = React.createContext<SetContext>( (_: persisted.Schema['requireAltTextEnabled']) => {}, ) +setContext.displayName = 'AltTextRequiredSetContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [state, setState] = React.useState( diff --git a/src/state/preferences/autoplay.tsx b/src/state/preferences/autoplay.tsx index 141c8161e..fb430487a 100644 --- a/src/state/preferences/autoplay.tsx +++ b/src/state/preferences/autoplay.tsx @@ -8,7 +8,9 @@ type SetContext = (v: boolean) => void const stateContext = React.createContext<StateContext>( Boolean(persisted.defaults.disableAutoplay), ) +stateContext.displayName = 'AutoplayStateContext' const setContext = React.createContext<SetContext>((_: boolean) => {}) +setContext.displayName = 'AutoplaySetContext' export function Provider({children}: {children: React.ReactNode}) { const [state, setState] = React.useState( diff --git a/src/state/preferences/disable-haptics.tsx b/src/state/preferences/disable-haptics.tsx index 367d4f7db..592b80ef3 100644 --- a/src/state/preferences/disable-haptics.tsx +++ b/src/state/preferences/disable-haptics.tsx @@ -8,7 +8,9 @@ type SetContext = (v: boolean) => void const stateContext = React.createContext<StateContext>( Boolean(persisted.defaults.disableHaptics), ) +stateContext.displayName = 'DisableHapticsStateContext' const setContext = React.createContext<SetContext>((_: boolean) => {}) +setContext.displayName = 'DisableHapticsSetContext' export function Provider({children}: {children: React.ReactNode}) { const [state, setState] = React.useState( diff --git a/src/state/preferences/external-embeds-prefs.tsx b/src/state/preferences/external-embeds-prefs.tsx index 9104bc71f..6d1f084ef 100644 --- a/src/state/preferences/external-embeds-prefs.tsx +++ b/src/state/preferences/external-embeds-prefs.tsx @@ -1,6 +1,6 @@ import React from 'react' -import {EmbedPlayerSource} from '#/lib/strings/embed-player' +import {type EmbedPlayerSource} from '#/lib/strings/embed-player' import * as persisted from '#/state/persisted' type StateContext = persisted.Schema['externalEmbeds'] @@ -12,7 +12,9 @@ type SetContext = ( const stateContext = React.createContext<StateContext>( persisted.defaults.externalEmbeds, ) +stateContext.displayName = 'ExternalEmbedsPrefsStateContext' const setContext = React.createContext<SetContext>({} as SetContext) +setContext.displayName = 'ExternalEmbedsPrefsSetContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [state, setState] = React.useState(persisted.get('externalEmbeds')) diff --git a/src/state/preferences/hidden-posts.tsx b/src/state/preferences/hidden-posts.tsx index 510af713d..f87460bf6 100644 --- a/src/state/preferences/hidden-posts.tsx +++ b/src/state/preferences/hidden-posts.tsx @@ -14,10 +14,12 @@ type ApiContext = { const stateContext = React.createContext<StateContext>( persisted.defaults.hiddenPosts, ) +stateContext.displayName = 'HiddenPostsStateContext' const apiContext = React.createContext<ApiContext>({ hidePost: () => {}, unhidePost: () => {}, }) +apiContext.displayName = 'HiddenPostsApiContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [state, setState] = React.useState(persisted.get('hiddenPosts')) diff --git a/src/state/preferences/in-app-browser.tsx b/src/state/preferences/in-app-browser.tsx index f8af067ee..36c480969 100644 --- a/src/state/preferences/in-app-browser.tsx +++ b/src/state/preferences/in-app-browser.tsx @@ -8,9 +8,11 @@ type SetContext = (v: persisted.Schema['useInAppBrowser']) => void const stateContext = React.createContext<StateContext>( persisted.defaults.useInAppBrowser, ) +stateContext.displayName = 'InAppBrowserStateContext' const setContext = React.createContext<SetContext>( (_: persisted.Schema['useInAppBrowser']) => {}, ) +setContext.displayName = 'InAppBrowserSetContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [state, setState] = React.useState(persisted.get('useInAppBrowser')) diff --git a/src/state/preferences/kawaii.tsx b/src/state/preferences/kawaii.tsx index 421689164..1835e0359 100644 --- a/src/state/preferences/kawaii.tsx +++ b/src/state/preferences/kawaii.tsx @@ -8,6 +8,7 @@ type StateContext = persisted.Schema['kawaii'] const stateContext = React.createContext<StateContext>( persisted.defaults.kawaii, ) +stateContext.displayName = 'KawaiiStateContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [state, setState] = React.useState(persisted.get('kawaii')) diff --git a/src/state/preferences/label-defs.tsx b/src/state/preferences/label-defs.tsx index e24a1144a..a03b69b52 100644 --- a/src/state/preferences/label-defs.tsx +++ b/src/state/preferences/label-defs.tsx @@ -1,5 +1,8 @@ import React from 'react' -import {AppBskyLabelerDefs, InterpretedLabelValueDefinition} from '@atproto/api' +import { + type AppBskyLabelerDefs, + type InterpretedLabelValueDefinition, +} from '@atproto/api' import {useLabelDefinitionsQuery} from '../queries/preferences' @@ -12,6 +15,7 @@ const stateContext = React.createContext<StateContext>({ labelDefs: {}, labelers: [], }) +stateContext.displayName = 'LabelDefsStateContext' export function Provider({children}: React.PropsWithChildren<{}>) { const state = useLabelDefinitionsQuery() diff --git a/src/state/preferences/languages.tsx b/src/state/preferences/languages.tsx index 8d705bf19..14ba62dba 100644 --- a/src/state/preferences/languages.tsx +++ b/src/state/preferences/languages.tsx @@ -1,6 +1,6 @@ import React from 'react' -import {AppLanguage} from '#/locale/languages' +import {type AppLanguage} from '#/locale/languages' import * as persisted from '#/state/persisted' type SetStateCb = ( @@ -20,6 +20,7 @@ type ApiContext = { const stateContext = React.createContext<StateContext>( persisted.defaults.languagePrefs, ) +stateContext.displayName = 'LanguagePrefsStateContext' const apiContext = React.createContext<ApiContext>({ setPrimaryLanguage: (_: string) => {}, setPostLanguage: (_: string) => {}, @@ -29,6 +30,7 @@ const apiContext = React.createContext<ApiContext>({ savePostLanguageToHistory: () => {}, setAppLanguage: (_: AppLanguage) => {}, }) +apiContext.displayName = 'LanguagePrefsApiContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [state, setState] = React.useState(persisted.get('languagePrefs')) diff --git a/src/state/preferences/large-alt-badge.tsx b/src/state/preferences/large-alt-badge.tsx index 9d2c9fa54..64bd68a8a 100644 --- a/src/state/preferences/large-alt-badge.tsx +++ b/src/state/preferences/large-alt-badge.tsx @@ -8,9 +8,11 @@ type SetContext = (v: persisted.Schema['largeAltBadgeEnabled']) => void const stateContext = React.createContext<StateContext>( persisted.defaults.largeAltBadgeEnabled, ) +stateContext.displayName = 'LargeAltBadgeStateContext' const setContext = React.createContext<SetContext>( (_: persisted.Schema['largeAltBadgeEnabled']) => {}, ) +setContext.displayName = 'LargeAltBadgeSetContext' export function Provider({children}: React.PropsWithChildren<{}>) { const [state, setState] = React.useState( diff --git a/src/state/preferences/moderation-opts.tsx b/src/state/preferences/moderation-opts.tsx index ecae85b9f..a6e36b7d2 100644 --- a/src/state/preferences/moderation-opts.tsx +++ b/src/state/preferences/moderation-opts.tsx @@ -1,5 +1,5 @@ -import React, {createContext, useContext, useMemo} from 'react' -import {BskyAgent, ModerationOpts} from '@atproto/api' +import {createContext, useContext, useMemo} from 'react' +import {BskyAgent, type ModerationOpts} from '@atproto/api' import {useHiddenPosts, useLabelDefinitions} from '#/state/preferences' import {DEFAULT_LOGGED_OUT_LABEL_PREFERENCES} from '#/state/queries/preferences/moderation' @@ -9,11 +9,13 @@ import {usePreferencesQuery} from '../queries/preferences' export const moderationOptsContext = createContext<ModerationOpts | undefined>( undefined, ) +moderationOptsContext.displayName = 'ModerationOptsContext' // used in the moderation state devtool export const moderationOptsOverrideContext = createContext< ModerationOpts | undefined >(undefined) +moderationOptsOverrideContext.displayName = 'ModerationOptsOverrideContext' export function useModerationOpts() { return useContext(moderationOptsContext) diff --git a/src/state/preferences/subtitles.tsx b/src/state/preferences/subtitles.tsx index e0e89feb1..ef7ff3376 100644 --- a/src/state/preferences/subtitles.tsx +++ b/src/state/preferences/subtitles.tsx @@ -8,7 +8,9 @@ type SetContext = (v: boolean) => void const stateContext = React.createContext<StateContext>( Boolean(persisted.defaults.subtitlesEnabled), ) +stateContext.displayName = 'SubtitlesStateContext' const setContext = React.createContext<SetContext>((_: boolean) => {}) +setContext.displayName = 'SubtitlesSetContext' export function Provider({children}: {children: React.ReactNode}) { const [state, setState] = React.useState( diff --git a/src/state/preferences/trending.tsx b/src/state/preferences/trending.tsx index 87ec68771..dc1f722c1 100644 --- a/src/state/preferences/trending.tsx +++ b/src/state/preferences/trending.tsx @@ -22,10 +22,12 @@ const StateContext = React.createContext<StateContext>({ trendingDisabled: Boolean(persisted.defaults.trendingDisabled), trendingVideoDisabled: Boolean(persisted.defaults.trendingVideoDisabled), }) +StateContext.displayName = 'TrendingStateContext' const ApiContext = React.createContext<ApiContext>({ setTrendingDisabled() {}, setTrendingVideoDisabled() {}, }) +ApiContext.displayName = 'TrendingApiContext' function usePersistedBooleanValue<T extends keyof persisted.Schema>(key: T) { const [value, _set] = React.useState(() => { diff --git a/src/state/preferences/used-starter-packs.tsx b/src/state/preferences/used-starter-packs.tsx index e4de479d5..302b0e1f4 100644 --- a/src/state/preferences/used-starter-packs.tsx +++ b/src/state/preferences/used-starter-packs.tsx @@ -6,7 +6,9 @@ type StateContext = boolean | undefined type SetContext = (v: boolean) => void const stateContext = React.createContext<StateContext>(false) +stateContext.displayName = 'UsedStarterPacksStateContext' const setContext = React.createContext<SetContext>((_: boolean) => {}) +setContext.displayName = 'UsedStarterPacksSetContext' export function Provider({children}: {children: React.ReactNode}) { const [state, setState] = React.useState<StateContext>(() => diff --git a/src/state/queries/messages/list-conversations.tsx b/src/state/queries/messages/list-conversations.tsx index 15da91071..3f8252519 100644 --- a/src/state/queries/messages/list-conversations.tsx +++ b/src/state/queries/messages/list-conversations.tsx @@ -62,6 +62,7 @@ const ListConvosContext = createContext<{ accepted: ChatBskyConvoDefs.ConvoView[] request: ChatBskyConvoDefs.ConvoView[] } | null>(null) +ListConvosContext.displayName = 'ListConvosContext' export function useListConvos() { const ctx = useContext(ListConvosContext) diff --git a/src/state/queries/notifications/unread.tsx b/src/state/queries/notifications/unread.tsx index da8d68126..8bbd00be0 100644 --- a/src/state/queries/notifications/unread.tsx +++ b/src/state/queries/notifications/unread.tsx @@ -35,12 +35,14 @@ interface ApiContext { } const stateContext = React.createContext<StateContext>('') +stateContext.displayName = 'NotificationsUnreadStateContext' const apiContext = React.createContext<ApiContext>({ async markAllRead() {}, async checkUnread() {}, getCachedUnreadPage: () => undefined, }) +apiContext.displayName = 'NotificationsUnreadApiContext' export function Provider({children}: React.PropsWithChildren<{}>) { const {hasSession} = useSession() diff --git a/src/state/service-config.tsx b/src/state/service-config.tsx index 37d5685bd..94be5b445 100644 --- a/src/state/service-config.tsx +++ b/src/state/service-config.tsx @@ -16,8 +16,10 @@ type LiveNowContext = { const TrendingContext = createContext<TrendingContext>({ enabled: false, }) +TrendingContext.displayName = 'TrendingContext' const LiveNowContext = createContext<LiveNowContext | null>(null) +LiveNowContext.displayName = 'LiveNowContext' export function Provider({children}: {children: React.ReactNode}) { const langPrefs = useLanguagePrefs() diff --git a/src/state/session/index.tsx b/src/state/session/index.tsx index 8223a7b3a..e7f37269c 100644 --- a/src/state/session/index.tsx +++ b/src/state/session/index.tsx @@ -30,8 +30,10 @@ const StateContext = React.createContext<SessionStateContext>({ currentAccount: undefined, hasSession: false, }) +StateContext.displayName = 'SessionStateContext' const AgentContext = React.createContext<BskyAgent | null>(null) +AgentContext.displayName = 'SessionAgentContext' const ApiContext = React.createContext<SessionApiContext>({ createAccount: async () => {}, @@ -42,6 +44,7 @@ const ApiContext = React.createContext<SessionApiContext>({ removeAccount: () => {}, partialRefreshSession: async () => {}, }) +ApiContext.displayName = 'SessionApiContext' export function Provider({children}: React.PropsWithChildren<{}>) { const cancelPendingTask = useOneTaskAtATime() 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()) diff --git a/src/state/threadgate-hidden-replies.tsx b/src/state/threadgate-hidden-replies.tsx index 8a3ee0f24..af3aaef5d 100644 --- a/src/state/threadgate-hidden-replies.tsx +++ b/src/state/threadgate-hidden-replies.tsx @@ -14,11 +14,13 @@ const StateContext = React.createContext<StateContext>({ uris: new Set(), recentlyUnhiddenUris: new Set(), }) +StateContext.displayName = 'ThreadgateHiddenRepliesStateContext' const ApiContext = React.createContext<ApiContext>({ addHiddenReplyUri: () => {}, removeHiddenReplyUri: () => {}, }) +ApiContext.displayName = 'ThreadgateHiddenRepliesApiContext' export function Provider({children}: {children: React.ReactNode}) { const [uris, setHiddenReplyUris] = React.useState<Set<string>>(new Set()) diff --git a/src/view/com/pager/PagerHeaderContext.tsx b/src/view/com/pager/PagerHeaderContext.tsx index c979f7a6d..b4ebcdcf9 100644 --- a/src/view/com/pager/PagerHeaderContext.tsx +++ b/src/view/com/pager/PagerHeaderContext.tsx @@ -1,5 +1,5 @@ import React, {useContext} from 'react' -import {SharedValue} from 'react-native-reanimated' +import {type SharedValue} from 'react-native-reanimated' import {isNative} from '#/platform/detection' @@ -7,6 +7,7 @@ export const PagerHeaderContext = React.createContext<{ scrollY: SharedValue<number> headerHeight: number } | null>(null) +PagerHeaderContext.displayName = 'PagerHeaderContext' /** * Passes information about the scroll position and header height down via |