next.js
a060fbf9 - Deflake per-page dynamic stale time test (#91492)

Commit
11 hours ago
Deflake per-page dynamic stale time test (#91492) ## Summary - Fixes flaky test "per-page value overrides global staleTimes.dynamic regardless of direction" introduced by #91437 - The test was flaky because `browser.back()` restored accordion state from BFCache, causing previously-opened `LinkAccordion` links to be immediately visible. This triggered uncontrolled re-prefetches outside the `act` scope. When the `IntersectionObserver` fired inside a subsequent `act` scope (after clock advancement), stale data would trigger a prefetch that violated the `no-requests` assertion. - Fix: instead of navigating back to a previously visited page, navigate forward to fresh "hub" pages with their own `LinkAccordion` components. Since these are never-visited pages, accordions start closed and no uncontrolled prefetches are triggered. - General principle: when using the router `act` test utility, always use `LinkAccordion` to control when prefetches happen. Prefetches should only be triggered inside an `act` scope by toggling an accordion, never by navigating back to a page where links are already visible. ## Test plan - [x] Ran the full test file 4 times locally — all 5 tests pass consistently
Author
Parents
Loading