first commit
This commit is contained in:
@@ -12,6 +12,7 @@ import { useLocation } from "react-router-dom";
|
||||
import { SplashScreen } from "../components/pwa/SplashScreen";
|
||||
|
||||
const MIN_SPLASH_MS = 400;
|
||||
const MAX_SPLASH_MS = 8000;
|
||||
const SKIP_SPLASH_KEY = "sproutclaw-warm-boot";
|
||||
|
||||
type BootstrapRoute = "chat" | "settings";
|
||||
@@ -44,6 +45,14 @@ export function BootstrapProvider({ children }: { children: ReactNode }) {
|
||||
mountTime.current = Date.now();
|
||||
}, [route]);
|
||||
|
||||
useEffect(() => {
|
||||
if (readyRoutes[route]) return;
|
||||
const timer = window.setTimeout(() => {
|
||||
setReadyRoutes((prev) => (prev[route] ? prev : { ...prev, [route]: true }));
|
||||
}, MAX_SPLASH_MS);
|
||||
return () => window.clearTimeout(timer);
|
||||
}, [route, readyRoutes]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!readyRoutes[route]) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user