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:
@@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user