From 674031b7f2b1b0fbabb13dd3820f2c547cc91ad4 Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Fri, 26 Jun 2026 23:56:43 -0700 Subject: [PATCH] FN-7101: stabilize App deep-link history state Reset App deep-link test history state around replaceState stubs so full-file order no longer leaks navigation state. - Reset the real browser history snapshot before stubbing replaceState. - Restore replaceState before cleanup so history state and URL are reset through the original implementation. - Document why deep-link tests must clear navIndex between mounts. Files changed: packages/dashboard/app/components/__tests__/App.test.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) Fusion-Task-Id: FN-7101 Fusion-Task-Lineage: 5c44441f-f0d2-4ad3-bdcf-5a0a0e3e6e6f Co-authored-by: Fusion (runfusion.ai) --- packages/dashboard/app/components/__tests__/App.test.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/dashboard/app/components/__tests__/App.test.tsx b/packages/dashboard/app/components/__tests__/App.test.tsx index b7b13b4fc6..5af02bb58a 100644 --- a/packages/dashboard/app/components/__tests__/App.test.tsx +++ b/packages/dashboard/app/components/__tests__/App.test.tsx @@ -1411,6 +1411,11 @@ describe("App deep link handling", () => { const originalReplaceState = window.history.replaceState; beforeEach(() => { + /* + * FNXC:DashboardTests 2026-06-26-23:40: + * Deep-link App tests stub `history.replaceState` for assertions, but `useNavigationHistory` still writes real `pushState` entries and preserves existing `history.state.navIndex`. Reset the real history snapshot before installing the stub so full-file ordering cannot mount a later Back test with stale browser state. + */ + originalReplaceState.call(window.history, null, "", "/"); window.history.replaceState = vi.fn(); Object.defineProperty(window, "location", { configurable: true, @@ -1419,11 +1424,12 @@ describe("App deep link handling", () => { }); afterEach(() => { + window.history.replaceState = originalReplaceState; + originalReplaceState.call(window.history, null, "", "/"); Object.defineProperty(window, "location", { configurable: true, value: originalLocation, }); - window.history.replaceState = originalReplaceState; }); it("fetches and opens the task modal when task query param is present", async () => {