diff --git a/app/packages/app/src/routing/RouterContext.ts b/app/packages/app/src/routing/RouterContext.ts index 6f25d6d46f..92a2114e16 100644 --- a/app/packages/app/src/routing/RouterContext.ts +++ b/app/packages/app/src/routing/RouterContext.ts @@ -90,8 +90,13 @@ export const createRouter = ( hard: false, handleError, }); - } catch { - return; + } catch (e) { + if (e instanceof Resource) { + // skip the page change if a resource is thrown + return; + } + + throw e; } requestAnimationFrame(() => { @@ -210,6 +215,7 @@ const makeGetEntryResource = () => { handleError?: (error: unknown) => void; }): Resource> => { if (isReusable(location)) { + // throw the current resource (page) if it can be reused throw currentResource; }