This repository was archived by the owner on Jul 19, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 113
fix(runtime-vapor): detach effect scope & component instance #174
Merged
Conversation
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
✅ Deploy Preview for vapor-repl ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for vapor-template-explorer ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Size ReportBundles
Usages
|
sxzz
approved these changes
Apr 5, 2024
sxzz
suggested changes
Apr 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. But could you please add unit tests for it?
Added unit tests to the critical path that triggered the bug. |
b6bde54
to
5a599d6
Compare
sxzz
approved these changes
Apr 16, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 existing
setCurrentInstance
will setinstance.scope.on()
internally andinstance.scope.off()
when calling reset, but as an internal Function, this hidden behavior is not very intuitive, and there are two problems:effectScope.on
cannot handle nested recursive calls to itself, because the internalprevScope
can only store one value.currentInstance
need to setinstance.scope.on()
at the same time, and this behavior is wrong inrenderEffect
.So this PR removes
instance.scope.on()
insetCurrentInstance
.I initially started investigating this issue because of the following bug.
Bug Playground
In this example, try entering text.
There won't be any problem if just adding texts, once the the pe-existing texts get deleted, it will cause the call to
setText
to fail.This is because when the
v-for
element get unmounted, theeffect.onStop()
that does not belong to thev-for
element would be mistakenly called. This is caused by the combined problems with problem "1" and "2" mentioned above.