about summary refs log tree commit diff
path: root/src/App.native.tsx
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-04-03 23:53:44 +0100
committerGitHub <noreply@github.com>2024-04-03 23:53:44 +0100
commit295a0949f44ef332c7b33e3cd03d0c2ea89047cf (patch)
tree96b6cc9ed615c9c7df6ba50628b92e8266fe489a /src/App.native.tsx
parent6c728f79dea65d9deeb57a430e6c9fad39940316 (diff)
downloadvoidsky-295a0949f44ef332c7b33e3cd03d0c2ea89047cf.tar.zst
Factor out QueryProvider (#3331)
Diffstat (limited to 'src/App.native.tsx')
-rw-r--r--src/App.native.tsx18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/App.native.tsx b/src/App.native.tsx
index 36944aa91..57ebe4951 100644
--- a/src/App.native.tsx
+++ b/src/App.native.tsx
@@ -12,20 +12,16 @@ import {
 import * as SplashScreen from 'expo-splash-screen'
 import {msg} from '@lingui/macro'
 import {useLingui} from '@lingui/react'
-import {PersistQueryClientProvider} from '@tanstack/react-query-persist-client'
+import {useQueryClient} from '@tanstack/react-query'
 
 import {Provider as StatsigProvider} from '#/lib/statsig/statsig'
 import {init as initPersistedState} from '#/state/persisted'
 import * as persisted from '#/state/persisted'
 import {Provider as LabelDefsProvider} from '#/state/preferences/label-defs'
 import {useIntentHandler} from 'lib/hooks/useIntentHandler'
-import {useNotificationsListener} from 'lib/notifications/notifications'
 import {useOTAUpdates} from 'lib/hooks/useOTAUpdates'
-import {
-  asyncStoragePersister,
-  dehydrateOptions,
-  queryClient,
-} from 'lib/react-query'
+import {useNotificationsListener} from 'lib/notifications/notifications'
+import {QueryProvider} from 'lib/react-query'
 import {s} from 'lib/styles'
 import {ThemeProvider} from 'lib/ThemeContext'
 import {Provider as DialogStateProvider} from 'state/dialogs'
@@ -58,8 +54,10 @@ SplashScreen.preventAutoHideAsync()
 function InnerApp() {
   const {isInitialLoad, currentAccount} = useSession()
   const {resumeSession} = useSessionApi()
+  const queryClient = useQueryClient()
   const theme = useColorModeTheme()
   const {_} = useLingui()
+
   useIntentHandler()
   useNotificationsListener(queryClient)
   useOTAUpdates()
@@ -123,9 +121,7 @@ function App() {
    * that is set up in the InnerApp component above.
    */
   return (
-    <PersistQueryClientProvider
-      client={queryClient}
-      persistOptions={{persister: asyncStoragePersister, dehydrateOptions}}>
+    <QueryProvider>
       <SessionProvider>
         <ShellStateProvider>
           <PrefsStateProvider>
@@ -147,7 +143,7 @@ function App() {
           </PrefsStateProvider>
         </ShellStateProvider>
       </SessionProvider>
-    </PersistQueryClientProvider>
+    </QueryProvider>
   )
 }