fix(reactivity): ensure multiple effectScope on() and off() calls maintains correct active scope#12641
Merged
fix(reactivity): ensure multiple effectScope on() and off() calls maintains correct active scope#12641
Conversation
on() calls by tracking call count
✅ Deploy Preview for vapor-repl ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
on() calls by tracking call count
yyx990803
added a commit
that referenced
this pull request
Jan 8, 2025
Member
Author
|
We need a minimal reproduction |
|
Seems like i missed something when comparing the code between this change and vue 3.5.14. It looks identical and i noticed i missed that effectScope was completely refactored in the vapor branch. I will try once again to provide a reproduction. Do you have any tips for trying to produce the memory leak with effectScope? |
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.
The following code does not work correctly in the current
vaporbranch. When thebuttonis clicked, the button text does not update.The issue is because
scope.onis called twice:simpleSetCurrentInstance>i.scope.on()if (scope) scope.on()core/packages/runtime-vapor/src/renderEffect.ts
Lines 30 to 31 in c2e7312
if
scopeequalsi.scopethe following happensThe core also has a similar issue, see #12631. It is also caused by
scope.on()being called multiple times. I have already created a PR #12632 to fix it. The changes in #12632 aim to avoid redundant updates to currentInstance, while this PR supports multiple calls toon. If this PR is merged, #12632 will no longer be needed.