@@ -20,7 +20,6 @@ import { useOnboardingStore } from "@posthog/ui/features/onboarding/onboardingSt
2020import { SettingsDialog } from "@posthog/ui/features/settings/SettingsDialog" ;
2121import { UpdateBanner } from "@posthog/ui/features/sidebar/components/UpdateBanner" ;
2222import { PendingPromptRecovery } from "@posthog/ui/features/task-detail/components/PendingPromptRecovery" ;
23- import { ensureTaskDetailCached } from "@posthog/ui/features/tasks/queries" ;
2423import { router } from "@posthog/ui/router/router" ;
2524import { AppLoadingScreen } from "@posthog/ui/shell/AppLoadingScreen" ;
2625import { track } from "@posthog/ui/shell/analytics" ;
@@ -36,10 +35,6 @@ interface AppProps {
3635 devToolbar ?: ReactNode ;
3736}
3837
39- // Cap on how long the boot gate waits for the restored task to fetch, so a
40- // slow or hung request can never block app startup.
41- const BOOT_WARMUP_MAX_MS = 5_000 ;
42-
4338function App ( { devToolbar } : AppProps ) {
4439 const { isBootstrapped } = useAuthSession ( ) ;
4540 const authState = useAuthStateValue ( ( state ) => state ) ;
@@ -94,28 +89,18 @@ function App({ devToolbar }: AppProps) {
9489 ! needsInviteCode &&
9590 ! needsAiApproval ;
9691
97- // Run the initial route's loaders and warm its task data before the router
98- // ever mounts, so the boot loading screen holds until the app is ready and
99- // no route spinner flashes.
92+ // Run the initial route's loaders before the router ever mounts, so the boot
93+ // loading screen holds until the route is ready.
10094 const [ initialRouteLoaded , setInitialRouteLoaded ] = useState ( false ) ;
10195 useEffect ( ( ) => {
10296 if ( initialRouteLoaded || ! readyForMainApp ) return ;
10397 let cancelled = false ;
104- const holdWhileLoading = async ( ) => {
105- await router . load ( ) . catch ( ( ) => undefined ) ;
106- const taskId = router . state . matches
107- . map ( ( match ) => ( match . params as { taskId ?: string } ) . taskId )
108- . find ( Boolean ) ;
109- if ( taskId ) {
110- await Promise . race ( [
111- ensureTaskDetailCached ( taskId ) ,
112- new Promise ( ( resolve ) => setTimeout ( resolve , BOOT_WARMUP_MAX_MS ) ) ,
113- ] ) ;
114- }
115- } ;
116- void holdWhileLoading ( ) . finally ( ( ) => {
117- if ( ! cancelled ) setInitialRouteLoaded ( true ) ;
118- } ) ;
98+ void router
99+ . load ( )
100+ . catch ( ( ) => undefined )
101+ . finally ( ( ) => {
102+ if ( ! cancelled ) setInitialRouteLoaded ( true ) ;
103+ } ) ;
119104 return ( ) => {
120105 cancelled = true ;
121106 } ;
0 commit comments