@@ -23,6 +23,9 @@ import {getPreservedNavigatorState} from './createSplitNavigator/usePreserveNavi
2323// This timing is used to call the preload function after a tab change, when the initial tab screen has already been rendered.
2424const TIMING_TO_CALL_PRELOAD = 1000 ;
2525
26+ // Currently, only the Account and Workspaces tabs are preloaded. The remaining tabs will be supported soon.
27+ const TABS_TO_PRELOAD = [ NAVIGATION_TABS . SETTINGS , NAVIGATION_TABS . WORKSPACES ] ;
28+
2629function preloadWorkspacesTab ( navigation : PlatformStackNavigationProp < AuthScreensParamList > ) {
2730 const state = getWorkspacesTabStateFromSessionStorage ( ) ?? navigation . getState ( ) ;
2831 const lastWorkspacesSplitNavigator = state . routes . findLast ( ( route ) => route . name === NAVIGATORS . WORKSPACE_SPLIT_NAVIGATOR ) ;
@@ -141,15 +144,13 @@ function usePreloadFullScreenNavigators() {
141144 }
142145 hasPreloadedRef . current = true ;
143146 setTimeout ( ( ) => {
144- Object . values ( NAVIGATION_TABS )
145- . filter ( ( tabName ) => {
146- const isCurrentTab = TAB_TO_FULLSCREEN [ tabName ] . includes ( route . name as FullScreenName ) ;
147- const isRouteAlreadyPreloaded = preloadedRoutes . some ( ( preloadedRoute ) => TAB_TO_FULLSCREEN [ tabName ] . includes ( preloadedRoute . name as FullScreenName ) ) ;
148- return ! isCurrentTab && ! isRouteAlreadyPreloaded ;
149- } )
150- . forEach ( ( tabName ) => {
151- preloadTab ( tabName , navigation , subscriptionPlan ) ;
152- } ) ;
147+ TABS_TO_PRELOAD . filter ( ( tabName ) => {
148+ const isCurrentTab = TAB_TO_FULLSCREEN [ tabName ] . includes ( route . name as FullScreenName ) ;
149+ const isRouteAlreadyPreloaded = preloadedRoutes . some ( ( preloadedRoute ) => TAB_TO_FULLSCREEN [ tabName ] . includes ( preloadedRoute . name as FullScreenName ) ) ;
150+ return ! isCurrentTab && ! isRouteAlreadyPreloaded ;
151+ } ) . forEach ( ( tabName ) => {
152+ preloadTab ( tabName , navigation , subscriptionPlan ) ;
153+ } ) ;
153154 } , TIMING_TO_CALL_PRELOAD ) ;
154155 } , [ isAuthenticated , isSingleNewDotEntry , route . name , preloadedRoutes , navigation , subscriptionPlan ] ) ,
155156 ) ;
0 commit comments