Repository navigation
fix(sidebar): stop auto-animate leaking detached rows via IntersectionObserver (#1475) - #1490
Merged
Merged
Conversation
…nObserver (#1475) auto-animate's debounced updatePos can fire after a row left the DOM and re-observe it. The observer is rooted at the document element, so Blink keeps it and the detached row subtree alive for the session: 4-5 leaked cards/shelves per status change in a soak. Skip observe() on detached targets; observing them measures nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r leak (#1475) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
2 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.
Part of #1475, round 3. The end-to-end measurement (
docs/perf/2026-10-06-end-to-end.md) showed renderer heap still climbing during the soak even with DOM bounded. Investigation notes are indocs/perf/2026-10-06-renderer-heap.md.Leak found:
@formkit/auto-animate0.10 (and the 1.0 betas) re-observes a sidebar row from a debounced timer that can fire after the row has left the DOM. The observer's root is the document element, so Blink keeps the observer, and the detached row subtree its callback closes over, alive for the session. The soak leaked one more observer, +38 DOM nodes and +5 listeners per stream; the same happens on every thread status change.Fix:
skipDetachedObserve()makesIntersectionObserver.prototype.observea no-op for a target that isn'tisConnected. Observing a detached element measures nothing, so no behaviour is lost.IntersectionObserveruser, both insrc/and in every runtime dependency.ponytail:note marks the global patch and says when to drop it.Measured (worker, development-mode build with production React, headless Chromium, 12-stream soak on the real 1,055-message thread):
Verified independently
vite buildpasses.listMotionObserve.test.tsfails on main.Open: the +12 MB heap rise seen in Electron's soak isn't reproduced in the browser (~1.5 MB there), so the rest is likely preload/IPC/thread-list specific. Re-measure in the app after this lands.
🤖 Generated with Claude Code