Pull useQueryClient-dependent code down in App.native

This commit is contained in:
Dan Abramov
2024-03-21 23:38:55 +00:00
parent 17b014f4ae
commit 9e36c4abb0
+8 -2
View File
@@ -53,12 +53,10 @@ SplashScreen.preventAutoHideAsync()
function InnerApp() { function InnerApp() {
const {isInitialLoad, currentAccount} = useSession() const {isInitialLoad, currentAccount} = useSession()
const {resumeSession} = useSessionApi() const {resumeSession} = useSessionApi()
const queryClient = useQueryClient()
const theme = useColorModeTheme() const theme = useColorModeTheme()
const {_} = useLingui() const {_} = useLingui()
useIntentHandler() useIntentHandler()
useNotificationsListener(queryClient)
// init // init
useEffect(() => { useEffect(() => {
@@ -78,6 +76,7 @@ function InnerApp() {
// Resets the entire tree below when it changes: // Resets the entire tree below when it changes:
key={currentAccount?.did}> key={currentAccount?.did}>
<QueryProvider> <QueryProvider>
<PushNotificationsListener>
<StatsigProvider> <StatsigProvider>
<LabelDefsProvider> <LabelDefsProvider>
<LoggedOutViewProvider> <LoggedOutViewProvider>
@@ -97,6 +96,7 @@ function InnerApp() {
</LoggedOutViewProvider> </LoggedOutViewProvider>
</LabelDefsProvider> </LabelDefsProvider>
</StatsigProvider> </StatsigProvider>
</PushNotificationsListener>
</QueryProvider> </QueryProvider>
</React.Fragment> </React.Fragment>
</Splash> </Splash>
@@ -105,6 +105,12 @@ function InnerApp() {
) )
} }
function PushNotificationsListener({children}: {children: React.ReactNode}) {
const queryClient = useQueryClient()
useNotificationsListener(queryClient)
return children
}
function App() { function App() {
const [isReady, setReady] = useState(false) const [isReady, setReady] = useState(false)