fix(nav): Back onto a page this build no longer has lands on the feed

A history entry pushed while the Messages page existed still names it after a reload onto the new
build; popstate took sfPage unchecked and the shell's module lookup threw. It is now validated with
isPage, like every initial-load path already was.
This commit is contained in:
2026-10-05 00:19:50 +02:00
parent 1f357b0c21
commit 2f901ad643
2 changed files with 18 additions and 2 deletions
@@ -176,6 +176,19 @@ describe("NavigationProvider · setPage's same-page guard", () => {
});
});
describe("NavigationProvider · Back", () => {
// A tab that had a since-removed module open, reloaded onto the new build: its older history
// entries still name that page, and Back lands on one of them.
it("lands on the feed when the entry names a page this build does not have", () => {
const { result } = render();
act(() => result.current.setPage("plex"));
act(() => {
window.dispatchEvent(new PopStateEvent("popstate", { state: { sfPage: "messages" } }));
});
expect(result.current.page).toBe("feed");
});
});
describe("NavigationProvider · never under an open overlay", () => {
it("setPage closes the overlay first and pushes only once its entry is reclaimed", async () => {
const { result } = render();