A question about cleanupEffect
in reactivity/effect.ts
#442
SnowingFox
started this conversation in
General
Replies: 1 comment 1 reply
-
You need to clean both ways. An effect has a Note that dependencies can link to other (multiple) effects that also depend on it. So when you want to disconnect all dependencies from an effect, you need two steps:
for (let i = 0; i < deps.length; i++) {
deps[i].delete(effect)
}
deps.length = 0 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
when i read effect.ts, i found this function
I have a question, why should we clean deps?
I found the
deps
type declaration is a similarly toSet[]
, so why not set the deps length to0
which also can clear deps item like thisBeta Was this translation helpful? Give feedback.
All reactions