Repository navigation
feat(replay): Add _experiments.ignoreMutations option - #16816
Merged
Merged
Conversation
Contributor
size-limit report 📦
|
chargome
reviewed
Jul 7, 2025
mydea
commented
Jul 7, 2025
This option allows to configure a selector list of elements to not capture mutation for.
ignoreMutations option_experiments.ignoreMutations option
mydea
force-pushed
the
fn/replay-ignoreMutations
branch
from
July 7, 2025 12:38
912ed5c to
10752f4
Compare
mydea
marked this pull request as ready for review
July 7, 2025 12:38
chargome
approved these changes
Jul 7, 2025
bricefriha
reviewed
Jul 7, 2025
Comment on lines
+13
to
+14
| const el: HTMLElement | null = node.nodeType === node.ELEMENT_NODE ? (node as HTMLElement) : node.parentElement; | ||
| return el; |
There was a problem hiding this comment.
What's the purpose of declaring the el constant here?
Is it to make debugging easier? 🙂
Suggested change
| const el: HTMLElement | null = node.nodeType === node.ELEMENT_NODE ? (node as HTMLElement) : node.parentElement; | |
| return el; | |
| return node.nodeType === node.ELEMENT_NODE ? (node as HTMLElement) : node.parentElement; |
Member
Author
There was a problem hiding this comment.
this is just vendored in from the rrweb implementation!
This was referenced Sep 29, 2025
This was referenced Oct 7, 2025
This was referenced Oct 15, 2025
mydea
added a commit
to getsentry/rrweb
that referenced
this pull request
Oct 27, 2026
…341) `onMutation` can currently only accept or drop a whole mutation batch. The Replay SDK needs per-mutation control for two cases: - **getsentry/sentry-javascript#16831**: mutations inside blocked elements still count toward `mutationLimit`, because `onMutation` runs before rrweb's block checks. Heavy SVG/D3 widgets can stop replays even when they are blocked. - **`_experiments.ignoreMutations`** (getsentry/sentry-javascript#16816): it currently drops the whole batch if any one mutation matches, which also drops unrelated mutations. This PR adds two things: - `onMutation` may return a `MutationRecord[]`. rrweb then processes only that subset. Returning `false` still skips the batch. Returning `true` or nothing still processes everything. - `onMutation` gets a second `helpers` argument with `isBlocked(node)`. It uses the recorder's own `blockClass`/`blockSelector`/`unblockSelector` rules, checking ancestors too, so callers don't have to re-implement them. Overhead is kept to a minimum. The helpers object is created once per observer, not per batch. `isBlocked` only runs when the caller invokes it, so the SDK can limit it to batches that exceed the mutation limit. The only new per-batch work is one `Array.isArray` check. This also drops the per-batch `.bind()` on `processMutations`, which is already an arrow-function property. Existing callers that return booleans behave the same. <!-- junior-request-attribution:start --> via **Francesco Gringl-Novy**. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:slack%3AD0CA8FXFXAS%3A1792739987.100699 --> -- [View Junior Session](https://junior-prod.sentry.dev/conversations/slack%3AD0CA8FXFXAS%3A1792739987.100699) [[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AD0CA8FXFXAS%3A1792739987.100699/?project=4510944073809921) <!-- junior-session-footer:end --> Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: Francesco Gringl-Novy <francesco.novy@sentry.io>
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.
This option allows to configure a selector list of elements to not capture mutation for.
This is under
_experimentsfor now:Fixes #16797