Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(mobile): page transitions hung four seconds on every navigation to a lazy page

Maurice654900bc50f5
diff --git a/client/src/mobile/routeTransition.ts b/client/src/mobile/routeTransition.ts
index 84c7ffdde..2987efe23 100644
--- a/client/src/mobile/routeTransition.ts
+++ b/client/src/mobile/routeTransition.ts
@@ -44,13 +44,19 @@ function canAnimate(): boolean {
);
}
-/** Resolves once no route fallback is on screen, or after SETTLE_MS. */
+/**
+ * Resolves once no route fallback is on screen, or after SETTLE_MS. Polled with
+ * a timer, never requestAnimationFrame: while a view transition waits for its
+ * update, the browser renders no frames, so a frame callback never came and the
+ * transition hung until the browser gave up after four seconds, on every
+ * navigation.
+ */
function settled(): Promise<void> {
const began = performance.now();
return new Promise((resolve) => {
const check = () => {
if (!document.querySelector('[data-route-fallback]') || performance.now() - began > SETTLE_MS) resolve();
- else requestAnimationFrame(check);
+ else window.setTimeout(check, 16);
};
check();
});