Open
Conversation
The "per-page value overrides global staleTimes.dynamic regardless of direction" test was flaky because it used browser.back() to return to /per-page-config where accordion state was restored from BFCache. This caused previously-opened LinkAccordion links to be immediately visible, triggering uncontrolled re-prefetches outside the act scope. When the IntersectionObserver fired inside the 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 that have their own LinkAccordion components. Since these are never-visited pages, the accordions start closed and no uncontrolled prefetches are triggered. Each hub page is dynamic (uses connection()) so act can properly manage the RSC requests during navigation. 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.
5c5f76f to
18e57cd
Compare
Collaborator
Tests Passed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
unstable_dynamicStaleTimeroute segment config #91437browser.back()restored accordion state from BFCache, causing previously-openedLinkAccordionlinks to be immediately visible. This triggered uncontrolled re-prefetches outside theactscope. When theIntersectionObserverfired inside a subsequentactscope (after clock advancement), stale data would trigger a prefetch that violated theno-requestsassertion.LinkAccordioncomponents. Since these are never-visited pages, accordions start closed and no uncontrolled prefetches are triggered.acttest utility, always useLinkAccordionto control when prefetches happen. Prefetches should only be triggered inside anactscope by toggling an accordion, never by navigating back to a page where links are already visible.Test plan