about summary refs log tree commit diff
path: root/src/App.native.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-11-16 12:53:43 -0800
committerGitHub <noreply@github.com>2023-11-16 12:53:43 -0800
commit54faa7e176ed2f8644ef4941c8a65522107a84c1 (patch)
tree336d69d37809041dcc38a932975fcf438ac60dfd /src/App.native.tsx
parente637798e05ba3bfc1c78be1b0f70e8b0ac22554d (diff)
downloadvoidsky-54faa7e176ed2f8644ef4941c8a65522107a84c1.tar.zst
Remove deprecated models and mobx usage (react-query refactor) (#1934)
* Update login page to use service query

* Update modal to use session instead of store

* Move image sizes cache off store

* Update settings to no longer use store

* Update link-meta fetch to use agent instead of rootstore

* Remove deprecated resolveName()

* Delete deprecated link-metas cache

* Delete deprecated posts cache

* Delete all remaining mobx models, including the root store

* Strip out unused mobx observer wrappers
Diffstat (limited to 'src/App.native.tsx')
-rw-r--r--src/App.native.tsx37
1 files changed, 12 insertions, 25 deletions
diff --git a/src/App.native.tsx b/src/App.native.tsx
index 3f49eb11f..af4c3be89 100644
--- a/src/App.native.tsx
+++ b/src/App.native.tsx
@@ -5,7 +5,6 @@ import React, {useState, useEffect} from 'react'
 import {RootSiblingParent} from 'react-native-root-siblings'
 import * as SplashScreen from 'expo-splash-screen'
 import {GestureHandlerRootView} from 'react-native-gesture-handler'
-import {observer} from 'mobx-react-lite'
 import {QueryClientProvider} from '@tanstack/react-query'
 
 import 'view/icons'
@@ -16,7 +15,6 @@ import {listenSessionDropped} from './state/events'
 import {useColorMode} from 'state/shell'
 import {ThemeProvider} from 'lib/ThemeContext'
 import {s} from 'lib/styles'
-import {RootStoreModel, setupState, RootStoreProvider} from './state'
 import {Shell} from 'view/shell'
 import * as notifications from 'lib/notifications/notifications'
 import * as analytics from 'lib/analytics/analytics'
@@ -44,22 +42,13 @@ i18n.activate('en')
 
 SplashScreen.preventAutoHideAsync()
 
-const InnerApp = observer(function AppImpl() {
+function InnerApp() {
   const colorMode = useColorMode()
   const {isInitialLoad} = useSession()
   const {resumeSession} = useSessionApi()
-  const [rootStore, setRootStore] = useState<RootStoreModel | undefined>(
-    undefined,
-  )
 
   // init
   useEffect(() => {
-    setupState().then(store => {
-      setRootStore(store)
-    })
-  }, [])
-
-  useEffect(() => {
     initReminders()
     analytics.init()
     notifications.init(queryClient)
@@ -72,7 +61,7 @@ const InnerApp = observer(function AppImpl() {
   }, [resumeSession])
 
   // show nothing prior to init
-  if (!rootStore || isInitialLoad) {
+  if (isInitialLoad) {
     // TODO add a loading state
     return null
   }
@@ -85,22 +74,20 @@ const InnerApp = observer(function AppImpl() {
     <UnreadNotifsProvider>
       <ThemeProvider theme={colorMode}>
         <analytics.Provider>
-          <RootStoreProvider value={rootStore}>
-            <I18nProvider i18n={i18n}>
-              {/* All components should be within this provider */}
-              <RootSiblingParent>
-                <GestureHandlerRootView style={s.h100pct}>
-                  <TestCtrls />
-                  <Shell />
-                </GestureHandlerRootView>
-              </RootSiblingParent>
-            </I18nProvider>
-          </RootStoreProvider>
+          <I18nProvider i18n={i18n}>
+            {/* All components should be within this provider */}
+            <RootSiblingParent>
+              <GestureHandlerRootView style={s.h100pct}>
+                <TestCtrls />
+                <Shell />
+              </GestureHandlerRootView>
+            </RootSiblingParent>
+          </I18nProvider>
         </analytics.Provider>
       </ThemeProvider>
     </UnreadNotifsProvider>
   )
-})
+}
 
 function App() {
   const [isReady, setReady] = useState(false)