Throttle high-frequency events and slim non-visible DOM in rrweb record() (#44) - #47
Open
SaintPepsi wants to merge 1 commit into
Open
Throttle high-frequency events and slim non-visible DOM in rrweb record() (#44)#47SaintPepsi wants to merge 1 commit into
SaintPepsi wants to merge 1 commit into
Conversation
…rd() REPLAY_DESIGN.md §4 specced sampling (throttle mousemove/scroll/media/input) and slimDOMOptions (drop <script>/comment/non-visible <head> metadata from snapshots) alongside the other record() tuning, but neither made it into the actual record() call in src/rrweb-recorder.js. Smaller win than the image/compression fixes (#45, #46) but free: none of this drops replay fidelity — it only removes redundant intermediate samples and DOM nodes that were never rendered. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
4 tasks
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
REPLAY_DESIGN.md§4 speccedsampling(throttle mousemove/scroll/media, dedupe input to last-value) andslimDOMOptions(drop<script>/preload tags, comments, and non-visible<head>metadata from DOM snapshots) alongside the otherrecord()tuning — neither made it into the actualrecord()call insrc/rrweb-recorder.js.slimDOMOptionsonly strips DOM nodes that are never rendered in the first place (<script>tags, HTML comments, favicon links, SEO/social meta tags).slimDOMOptionshere deliberately turns onheadMetaAuthorship/headMetaDescKeywords— more aggressive than rrweb's ownslimDOMOptions: trueshorthand, which leaves those two off because they can carry info some consumers want to keep. A bug report's replay has no use for a page's meta description or author tag, so the full object fromREPLAY_DESIGN.mdis used as specced rather than the shorthand.This is the smallest of the 3 mitigations from my comment on #44 (image encoding is #45, event-stream compression is #46) — it's additive to both and doesn't touch the same code paths.
Test plan
npm run build— cleanbun test test/recorder.test.js— 9/9 pass, including new causal-guard assertions oncapturedOpts.samplingandcapturedOpts.slimDOMOptions(mirroring the existinginlineImagesguard)bun test test/— 88/90 pass; the 2 failures (test/packaging.test.js) are pre-existing onmain, unrelated to this change: one is a Windows path-separator artifact in the packaged-file check, the other isdocs/STORE_LISTING.mdgenuinely missing CWS justification blocks for several permissions (a real doc gap, not a path issue) — confirmed by running the same test against unmodifiedmainsampling/slimDOMOptionslines insrc/rrweb-recorder.jsand rerantest/recorder.test.js— the new assertions go red as expected🤖 Generated with Claude Code
Note: #45 (
fix/44-webp-inline-images) edits the samerecord({...})call block insrc/rrweb-recorder.js. Both are independent, non-stacked PRs — merging both will hit a textual (not semantic) conflict at that call site that needs manual reconciliation; the options compose fine (inlineImages,dataURLOptions,sampling,slimDOMOptionsare all independent keys).