Add RAF cleanup on unmount to prevent state updates after unmount#1333
Merged
langonginc merged 3 commits intoreduce-reduxfrom Feb 12, 2026
Merged
Add RAF cleanup on unmount to prevent state updates after unmount#1333langonginc merged 3 commits intoreduce-reduxfrom
langonginc merged 3 commits intoreduce-reduxfrom
Conversation
Co-authored-by: langonginc <59787082+langonginc@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update on scripting performance enhancements for canvas dragging
Add RAF cleanup on unmount to prevent state updates after unmount
Feb 12, 2026
Member
|
@copilot Move it after all event handlers |
Co-authored-by: langonginc <59787082+langonginc@users.noreply.github.com>
Contributor
Author
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a component-unmount cleanup to prevent a pending requestAnimationFrame callback from firing after SvgWrapper has unmounted, avoiding post-unmount setState calls and related leak/warning risk.
Changes:
- Add a
useEffectcleanup that cancels any in-flight RAF on unmount. - Reset
rafRef.currenttonullduring cleanup to keep state consistent.
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.
useEffectto cancel RAF on component unmountuseEffectafter all event handlers (comment #3889831649)✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.