fix(nav): Back onto a removed page also rewrites the entry to the feed

The fallback rendered the feed but left the history entry and the address bar on the dead page, so
a Feed click was a no-op (the same-page guard), filter mirroring kept `?page=messages` and the nav
diagnostics logged a page that does not exist. The entry is now replaced with the feed's, keeping
every other URL key (test red without it).
This commit is contained in:
2026-10-05 00:50:35 +02:00
parent 58ad95263c
commit 5257d57196
2 changed files with 8 additions and 0 deletions
@@ -183,9 +183,13 @@ describe("NavigationProvider · Back", () => {
const { result } = render();
act(() => result.current.setPage("plex"));
act(() => {
window.history.replaceState({ sfPage: "messages" }, "", "/?page=messages&keep=1");
window.dispatchEvent(new PopStateEvent("popstate", { state: { sfPage: "messages" } }));
});
expect(result.current.page).toBe("feed");
// …and the entry says so too, so the address bar and a later Feed click agree with the screen.
expect(window.history.state).toMatchObject({ sfPage: "feed" });
expect(window.location.search).toBe("?keep=1");
});
});