From b556189d4cf57aacd889bb0e4422daa8002fd7c8 Mon Sep 17 00:00:00 2001 From: Steven Vandevelde Date: Thu, 17 Sep 2026 21:47:46 +0200 Subject: [PATCH] fix: upgrade button on dashboard --- deno.lock | 4 ++++ src/common/pages/ppr.js | 28 +++++++++++++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/deno.lock b/deno.lock index d19d08db..f06289f6 100644 --- a/deno.lock +++ b/deno.lock @@ -3172,6 +3172,10 @@ "https://cdn.jsdelivr.net/gh/denosaurs/deno_brotli@0.1.7/mod.ts": "08b913e51488b6e7fa181f2814b9ad087fdb5520041db0368f8156bfa45fd73e", "https://cdn.jsdelivr.net/gh/denosaurs/deno_brotli@0.1.7/wasm.js": "77771b89e89ec7ff6e3e0939a7fb4f9b166abec3504cec0532ad5c127d6f35d2", "https://cdn.jsdelivr.net/gh/lumeland/bar@0.1.14/types.ts": "38f3714e1432c174009495333972f85fb306eb6313112ac8830fda9f1f47e87f", + "https://cdn.jsdelivr.net/gh/lumeland/lume@3.1.4/core/utils/lume_config.ts": "3fa08358cdd2ee4f8279347c4c74e2f457d0aa31ccc2201f85f455d31b620f2b", + "https://cdn.jsdelivr.net/gh/lumeland/lume@3.1.4/core/utils/path.ts": "7a1d199113928cc35782aa3262cbe6f7a4894bc262d7d300de9385b3da45602f", + "https://cdn.jsdelivr.net/gh/lumeland/lume@3.1.4/deps/path.ts": "a3d24ee31773ba6ef19b588612f376acef0ad5d3d761c4d9a315f79036cc87a4", + "https://cdn.jsdelivr.net/gh/lumeland/lume@3.1.4/lint.ts": "41c1bb62434eb9d8e39a255c0dd9cd10734451dd208e3263b5e1c9835732556e", "https://cdn.jsdelivr.net/gh/lumeland/lume@3.2.4/cli.ts": "d8fc878eb1d52c85d5778ec2965d7c0084a351c90741c5f629e24c16e8b53ba5", "https://cdn.jsdelivr.net/gh/lumeland/lume@3.2.4/cli/build.ts": "61290fc7d533f605d4d96a258775b50006f07b769346451d3d63abd883b9342f", "https://cdn.jsdelivr.net/gh/lumeland/lume@3.2.4/cli/create.ts": "78208f4c5e19f9f18b5d4ed3762c69d9e4ea666a2d139bdca4b6eb1c6b164720", diff --git a/src/common/pages/ppr.js b/src/common/pages/ppr.js index a91fc192..3b214ecc 100644 --- a/src/common/pages/ppr.js +++ b/src/common/pages/ppr.js @@ -7,6 +7,22 @@ import * as Nav from "./nav.js"; /** Base pathname of the app (e.g. "/" at root, "/diffuse/" in a subdirectory). */ const BASE_PATHNAME = new URL(document.baseURI).pathname; +/** + * Kitchen app pages that can be updated in place via the Navigation API. + * + * Any other same-origin path (version aliases like `/latest/`, versioned + * or CID URLs, the loader and chronicle pages) must do a full page load: + * upgrading to a new version requires loading that version's shell (scripts + * and styles), which swapping `
` alone would never do. + */ +const KITCHEN_PATHS = new Set([ + "dashboard", + "guide", + "featured", + "catalogue", + "create", +]); + /** * Strips the app's base path prefix from an absolute pathname, * returning a root-relative path like "/code". @@ -77,15 +93,13 @@ function navigateHandler(event) { if (url.origin !== location.origin) return; if (url.pathname === location.pathname) return; - // Only intercept paths one level deep + // Only intercept kitchen app pages one level deep. Everything else + // (e.g. `/latest/`, `/l/...`, `/chronicle/`) keeps its default full + // page load, so version upgrades load the new version's shell. const relative = relativePathname(url.pathname); const parts = relative.split("/").filter(Boolean); - if (parts.length === 0) return; - if (parts.length > 2) return; - - // Skip the loader page - if (parts[0] === "l") return; - if (parts.includes("chronicle")) return; + if (parts.length !== 1) return; + if (!KITCHEN_PATHS.has(parts[0])) return; event.intercept({ scroll: "manual", -- 2.51.2