Conversation
ShimmerView started an infinite withRepeat sweep in an effect but never cancelled it. When the component unmounts the animation driver stays live and, through useAnimatedStyle, keeps the Animated gradient and its MaskedView subtree referenced. On web that subtree renders as an <svg> mask, so every unmounted shimmer leaks a detached SVG tree (SVGAnimatedLength/TransformList/ SMILTimeContainer seen retained by the animation-driver closure scope in heap-snapshot diffs) and pins an animation driver — the heap grows the longer the tab lives. Add the cleanup to stop the repeat on unmount, matching StatusDot and ShimmerText (which already cancel on unmount). Refs slopus#1765. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This was referenced Sep 17, 2026
Open
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.
Problem
ShimmerViewkicks off an infinitewithRepeatsweep in auseEffectbut never cancels it. When the component unmounts, the animation driver stays live and — throughuseAnimatedStyle— keeps theAnimatedgradient and itsMaskedViewsubtree referenced.On web that
MaskedViewrenders as an<svg>mask, so every unmounted shimmer leaks a detached SVG tree and pins an animation driver. On a long-lived tab this grows the heap.Diagnosed on
happy.federicoliva.it(self-host web) via heap-snapshot diff: detached SVG objects (SVGAnimatedLength,SVGAnimatedTransformList,blink::SMILTimeContainer,SVGSVGElement) retained by the reanimated animation-driver closure scope (system / Context / scope).Same class of bug as the
StatusDotpulse (#1796).ShimmerTextalready cancels on unmount;ShimmerViewwas the one left.Fix
Return a cleanup from the effect that calls
cancelAnimation(shimmerTranslate)on unmount, so the driver stops and the gradient/mask subtree can be collected.Part of the perf work in #1765.
🤖 Generated with Claude Code