From 7eec69b3c7cfcc1c95a74a63b7c3105c4680ff23 Mon Sep 17 00:00:00 2001 From: Robin Munn Date: Fri, 24 Jul 2026 14:42:34 +0700 Subject: [PATCH] Don't give up on popstate event too quickly Occasionally, in dev, popstate can take more than 100ms to return, such as when a dialog change ends up loading new code that Vite hasn't compiled yet (which happens synchronously while the await is still waiting to be fulfilled). A 500ms timeout should be enough for most situations, while still being short enough not to be annoying to wait for if it is reporting an actual error. --- frontend/viewer/src/lib/utils/history.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/viewer/src/lib/utils/history.ts b/frontend/viewer/src/lib/utils/history.ts index cd6a2613e6..e3dbb61ef5 100644 --- a/frontend/viewer/src/lib/utils/history.ts +++ b/frontend/viewer/src/lib/utils/history.ts @@ -47,7 +47,7 @@ async function doHistoryChange(change: HistoryChange): Promise { } } -export async function awaitPopstate(timeout = 100): Promise { +export async function awaitPopstate(timeout = 500): Promise { const controller = new AbortController(); const result = await Promise.any([ new Promise<'popstate'>(resolve => {