about summary refs log tree commit diff
path: root/src/App.web.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.web.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.web.tsx')
-rw-r--r--src/App.web.tsx37
1 files changed, 12 insertions, 25 deletions
diff --git a/src/App.web.tsx b/src/App.web.tsx
index e1f4e8030..67fa3dcc3 100644
--- a/src/App.web.tsx
+++ b/src/App.web.tsx
@@ -1,7 +1,6 @@
 import 'lib/sentry' // must be near top
 
 import React, {useState, useEffect} from 'react'
-import {observer} from 'mobx-react-lite'
 import {QueryClientProvider} from '@tanstack/react-query'
 import {SafeAreaProvider} from 'react-native-safe-area-context'
 import {RootSiblingParent} from 'react-native-root-siblings'
@@ -12,7 +11,6 @@ import {init as initPersistedState} from '#/state/persisted'
 import {init as initReminders} from '#/state/shell/reminders'
 import {useColorMode} from 'state/shell'
 import * as analytics from 'lib/analytics/analytics'
-import {RootStoreModel, setupState, RootStoreProvider} from './state'
 import {Shell} from 'view/shell/index'
 import {ToastContainer} from 'view/com/util/Toast.web'
 import {ThemeProvider} from 'lib/ThemeContext'
@@ -34,22 +32,13 @@ import {
 import {Provider as UnreadNotifsProvider} from 'state/queries/notifications/unread'
 import * as persisted from '#/state/persisted'
 
-const InnerApp = observer(function AppImpl() {
+function InnerApp() {
   const {isInitialLoad} = useSession()
   const {resumeSession} = useSessionApi()
   const colorMode = useColorMode()
-  const [rootStore, setRootStore] = useState<RootStoreModel | undefined>(
-    undefined,
-  )
 
   // init
   useEffect(() => {
-    setupState().then(store => {
-      setRootStore(store)
-    })
-  }, [])
-
-  useEffect(() => {
     initReminders()
     analytics.init()
     dynamicActivate(defaultLocale) // async import of locale data
@@ -59,7 +48,7 @@ const InnerApp = observer(function AppImpl() {
   }, [resumeSession])
 
   // show nothing prior to init
-  if (!rootStore || isInitialLoad) {
+  if (isInitialLoad) {
     // TODO add a loading state
     return null
   }
@@ -72,22 +61,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>
-                <SafeAreaProvider>
-                  <Shell />
-                </SafeAreaProvider>
-              </RootSiblingParent>
-            </I18nProvider>
-            <ToastContainer />
-          </RootStoreProvider>
+          <I18nProvider i18n={i18n}>
+            {/* All components should be within this provider */}
+            <RootSiblingParent>
+              <SafeAreaProvider>
+                <Shell />
+              </SafeAreaProvider>
+            </RootSiblingParent>
+          </I18nProvider>
+          <ToastContainer />
         </analytics.Provider>
       </ThemeProvider>
     </UnreadNotifsProvider>
   )
-})
+}
 
 function App() {
   const [isReady, setReady] = useState(false)