-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent Reaction From Keeping a Reference to The OldValue #3812
Conversation
🦋 Changeset detectedLatest commit: a3d5692 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Did you investigate the behavior when |
@urugator |
Ok, thank you. Could you please provide changeset ( |
I never made a changeset before. I ran |
Yep. Github just seems to be sluggish atm, at least on mind end. |
HI Folks
This PR is about
reaction
and memory retainment preventing object beeing garbage collectedFor some reason, the
reactionRunner
of a reaction creates a closure around anoldValue
and so the reference to theoldValue
is kept untill a newValue is computed.I can see no reason for keeping such a reference "alive",
oldValue
could just be declared in the scope of thereactionRunner
as it is the only place where it is used. Doing so, theoldValue
can be garbage collected if needed.No additional Unit test is needed for such a change, and there is no backward compatibility issue as it only touches internal/private stuff within a
reaction
.