next.js
8d6cef52 - Report end on Activity reveal and canonical relative URLs on traverse

Commit
135 days ago
Report end on Activity reveal and canonical relative URLs on traverse Two fixes from evaluating the lifecycle against a real cacheComponents app (the vercel/front templates gallery on a preview deployment): - The end marker reported once per instance mount from an insertion effect, so a traversal that re-shows a page preserved in a hidden <Activity> boundary (cacheComponents bfcache) never fired end: nothing remounts on reveal. Report from a dependency-free layout effect instead — layout effects disconnect/reconnect across Activity hide/reveal, so the reveal re-fires the report, while a navigation that merely swaps the context value under a marker that stayed on screen still does not. Event ordering is unchanged (insertion effects, where commit is emitted, run before layout effects within a React commit); markerDidShow remains as a defensive latch. - The popstate handler reported window.location.href for traversals while pushes report the caller's href, so the hooks' url argument shape depended on the navigation type. Traversals now report the canonical relative form (createHrefFromUrl). The fixture now records the raw url argument, and the suite covers both: a traversal back to a marked page reports the traversal's own end (fails against the previous marker under __NEXT_CACHE_COMPONENTS=true), and url is the canonical relative href on every navigation type.
Author
Jude Gao
Parents
Loading