fix(replay): use live click attributes in breadcrumbs#20262
Open
fix(replay): use live click attributes in breadcrumbs#20262
Conversation
Co-Authored-By: GPT-5 <noreply@anthropic.com>
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Cloudflare
Core
Deps
Other
Bug Fixes 🐛Deno
Other
Internal Changes 🔧Ci
Deps
Other
🤖 This preview updates automatically when you update the PR. |
Co-Authored-By: GPT-5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Replay click breadcrumbs so recorded node attributes prefer the current/live DOM element attributes (to avoid stale rrweb mirror metadata), while still using rrweb metadata for the rest of the breadcrumb node payload. Adds a regression unit test covering attribute mutation/staleness.
Changes:
- Update DOM breadcrumb construction to source
attributesfrom the liveElementwhen available. - Keep rrweb snapshot metadata as the source for
tagName/textContent(when present). - Add a unit test ensuring live attributes win over stale mirror metadata.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/replay-internal/src/coreHandlers/handleDom.ts | Prefer live element attributes for breadcrumb node attributes; add helper to serialize Element.attributes. |
| packages/replay-internal/test/unit/coreHandlers/handleDom.test.ts | Add regression test asserting live attributes override stale rrweb meta; restore mocks after each test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** Get the base DOM breadcrumb. */ | ||
| export function getBaseDomBreadcrumb(target: Node | null, message: string): Breadcrumb { | ||
| const nodeId = record.mirror.getId(target); | ||
| const node = nodeId && record.mirror.getNode(nodeId); |
packages/replay-internal/test/unit/coreHandlers/handleDom.test.ts
Outdated
Show resolved
Hide resolved
Contributor
size-limit report 📦
|
Co-Authored-By: GPT-5 <noreply@anthropic.com>
Co-Authored-By: GPT-5 <noreply@anthropic.com>
Co-Authored-By: GPT-5 <noreply@anthropic.com>
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.
Fixes replay element attributes grabbing a potentially stale version of the attributes, we basically now prefer the live element if available, otherwise we keep the old behavior.
closes #20238