feat(effectScope): allow multiple on()
calls by tracking call count
#12641
+26
−3
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
vapor
branch. When thebutton
is clicked, the button text does not update.The issue is because
scope.on
is called twice:simpleSetCurrentInstance
>i.scope.on()
if (scope) scope.on()
core/packages/runtime-vapor/src/renderEffect.ts
Lines 30 to 31 in c2e7312
if
scope
equalsi.scope
the 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.