diff --git a/src/state/appConfig.tsx b/src/state/appConfig.tsx index 6f5b0096c8..3eb127b410 100644 --- a/src/state/appConfig.tsx +++ b/src/state/appConfig.tsx @@ -27,7 +27,7 @@ export const DEFAULT_APP_CONFIG_RESPONSE: AppConfigResponse = { }, } -let fetchAppConfigPromise: Promise +let fetchAppConfigPromise: Promise async function fetchAppConfig(): Promise { try { @@ -37,15 +37,13 @@ async function fetchAppConfig(): Promise { async () => { const r = await fetch(`${APP_CONFIG_URL}/config`) if (!r.ok) throw new Error(await r.text()) - return r + const data = await r.json() + return data }, 1e3, ) } - const res = await fetchAppConfigPromise - if (!res.ok) return null - const data = await res.json() - return data + return await fetchAppConfigPromise } catch { return null } diff --git a/src/state/service-config.tsx b/src/state/service-config.tsx index 5470f56e4e..e102cde2f9 100644 --- a/src/state/service-config.tsx +++ b/src/state/service-config.tsx @@ -8,19 +8,11 @@ type TrendingContext = { enabled: boolean } -type LiveNowContext = { - did: string - domains: string[] -}[] - const TrendingContext = createContext({ enabled: false, }) TrendingContext.displayName = 'TrendingContext' -const LiveNowContext = createContext([]) -LiveNowContext.displayName = 'LiveNowContext' - const CheckEmailConfirmedContext = createContext(null) export function Provider({children}: {children: React.ReactNode}) { @@ -57,19 +49,15 @@ export function Provider({children}: {children: React.ReactNode}) { return {enabled} }, [isInitialLoad, config, langPrefs.contentLanguages]) - const liveNow = useMemo(() => config?.liveNow ?? [], [config]) - // probably true, so default to true when loading // if the call fails, the query will set it to false for us const checkEmailConfirmed = config?.checkEmailConfirmed ?? true return ( - - - {children} - - + + {children} + ) }