diff options
Diffstat (limited to 'src/state')
47 files changed, 99 insertions, 10 deletions
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()) |