@rrweb/record
2.2.0 · 24 Oct 2026MIT1.1M / weekRepositoryHomepagenpmAtom feed
In short
1 new5 fixed3 internal
Release note
Minor Changes
Add a top-level annotation event with
record.addAnnotation()andreplayer.on('annotation', handler). Annotation data usestype: 'caption'ortype: 'timelineMarker'. ImportannotationDatafrom@rrweb/typesto type annotation data. The player can display these annotations as captions and interactive timeline markers.
Patch Changes
Fix record-side memory leaks and duplicate mutation emission:
Stopping a recording now releases the root document's mutation buffer and observer — previously the document observer was only disconnected, so each start/stop cycle leaked one buffer — and removes the cross-origin iframe
messagelistener.A same-origin iframe is observed once instead of re-observed on every full snapshot (
checkoutEveryNth/checkoutEveryNms/manualtakeFullSnapshot), so a single iframe mutation is no longer emitted once per checkout; its observers are also released when the iframe is removed or navigates away.The untainted-
MutationObserverhelper iframe used on WebKit/Safari is reference-counted, so it is torn down only when the last observer stops and will get rebuilt for a later recording.
Disconnect shadow-DOM observers when their host is removed
Each observed shadow root kept a live
MutationObserverplus its mutation buffer for the rest of the recording session even if its host was removed, a memory leak problem for component-heavy pages. Fix: release shadow observers and buffers as soon as we observe them as removed/detached from dom with tests added for the still-attached host-moved case, and to ensure they get re-observed on reinsertion.Release removed shadow trees from the mirror
Removing a shadow host from DOM was leaving references to shadow descendants, so e.g. repeatedly replacing web components mem-leaked their detached trees. Fix by recursing into shadow roots during removal, including nested hosts and releasing strong references from the mirror.