fix: keep demo mock switch on app shell

This commit is contained in:
3252a8
2026-05-28 15:05:48 +03:00
parent d544ebd879
commit cf05c6580d
+8 -1
View File
@@ -103,6 +103,13 @@ const materializedRouteFromRuntime = (route) => {
};
const publicPathFromRoute = (route) => `${demoBase}${materializedRouteFromRuntime(route)}`;
const runtimeSrc = (route, searchParams = new URLSearchParams()) => {
const nextParams = new URLSearchParams(searchParams);
nextParams.delete("screen");
nextParams.delete("admin_section");
nextParams.set("path", normalizePath(route));
return `${runtimeBase}/app.html?${nextParams.toString()}${window.location.hash || ""}`;
};
const topbar = document.querySelector(".demo-topbar");
const toggle = document.querySelector(".demo-topbar__toggle");
const hide = document.querySelector(".demo-topbar__hide");
@@ -156,5 +163,5 @@ stateSelect?.addEventListener("change", () => {
const query = nextParams.toString();
const publicUrl = `${demoBase}/home${query ? `?${query}` : ""}`;
window.history.replaceState(null, "", publicUrl);
frame.src = `${runtimeBase}/home?mock=${mock}`;
frame.src = runtimeSrc("/home", nextParams);
});