diff --git a/src/App.native.tsx b/src/App.native.tsx index 5c4918f91d..60bce0578d 100644 --- a/src/App.native.tsx +++ b/src/App.native.tsx @@ -72,22 +72,28 @@ const InnerApp = observer(function AppImpl() { return null } + /* + * Session and initial state should be loaded prior to rendering below. + */ + return ( - - - - - {/* All components should be within this provider */} - - - - - - - - - - + + + + + + {/* All components should be within this provider */} + + + + + + + + + + + ) }) @@ -102,19 +108,21 @@ function App() { return null } + /* + * NOTE: only nothing here can depend on other data or session state, since + * that is set up in the InnerApp component above. + */ return ( - - - - - - - + + + + + diff --git a/src/App.web.tsx b/src/App.web.tsx index 7bb6cb2568..b734aea087 100644 --- a/src/App.web.tsx +++ b/src/App.web.tsx @@ -60,22 +60,28 @@ const InnerApp = observer(function AppImpl() { return null } + /* + * Session and initial state should be loaded prior to rendering below. + */ + return ( - - - - - {/* All components should be within this provider */} - - - - - - - - - - + + + + + + {/* All components should be within this provider */} + + + + + + + + + + + ) }) @@ -90,19 +96,21 @@ function App() { return null } + /* + * NOTE: only nothing here can depend on other data or session state, since + * that is set up in the InnerApp component above. + */ return ( - - - - - - - + + + + + diff --git a/src/state/queries/preferences/index.ts b/src/state/queries/preferences/index.ts index 4f10b01a6f..7e16d4e9a4 100644 --- a/src/state/queries/preferences/index.ts +++ b/src/state/queries/preferences/index.ts @@ -32,6 +32,7 @@ export const usePreferencesQueryKey = ['getPreferences'] export function usePreferencesQuery() { const {agent, hasSession} = useSession() return useQuery({ + enabled: hasSession, queryKey: usePreferencesQueryKey, queryFn: async () => { const res = await agent.getPreferences() @@ -83,7 +84,6 @@ export function usePreferencesQuery() { } return preferences }, - enabled: hasSession, }) }