feat(replay): capture SPA route changes as navigation events#7
Merged
Conversation
rrweb only emits a META event on full page loads, so client-side route
changes were never recorded and downstream page segmentation saw a whole
SPA session as a single page.
The replay module now patches history.pushState/replaceState (neither
fires natively) and listens for popstate, emitting a stable `navigation`
rrweb custom event ({ href, title? }) on each real URL change. Deduped on
the last emitted href. Survives idle session rotation (dedup baseline reset
so each rotated session re-emits its entry URL). Each wrapper carries the
genuine original so a re-install after a failed teardown cannot stack
wrappers. Skipped in cross-origin iframes; every path fails open.
Backend distiller wiring is tracked separately (#889 workstream 3).
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Document the SDK-side workflow for linking an unreleased launchkit build into a consumer app with yalc (build, yalc publish, yalc push, revert), and point to the full consumer-side runbook in the monorepo. Closes the gap where launchkit had no local-publish docs in its own CLAUDE.md. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.
What
rrweb only emits a META event on full page loads, so client-side route changes in SPAs were never recorded and downstream page segmentation saw a whole session as a single page.
The replay module now installs a navigation watcher (inside the lazy rrweb-import boundary) that:
history.pushState/replaceStateand listens forpopstate,navigationrrweb custom event ({ href, title? }) on each real URL change,Event contract (stable)
"navigation"{ href: string, title?: string }—hrefislocation.href,titleisdocument.titlewhen non-empty.Tests
249 vitest tests pass (8 navigation-watcher cases incl. rotation baseline reset + anti-stacking, both proven by mutation). type-check + build green.
Scope
SDK capture only. Backend distiller wiring (treating
navigationevents and appending topages_visited) is tracked as the #889 workstream 3 in thevulk-corp/bworldsmonorepo and done separately.Bumps to
1.12.0(minor) + CHANGELOG. Adds a local yalc testing runbook to CLAUDE.md.🤖 Generated with Claude Code