-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
feat(effectScope): add lazy-initialized signal
getter with automatic abort on stop
#13908
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
base: minor
Are you sure you want to change the base?
Conversation
Someday, we could follow up on this by merging the effects signal with its parent signals ( core/packages/reactivity/src/effectScope.ts Lines 151 to 154 in 179b397
|
Size ReportBundles
Usages
|
LGTM |
179b397
to
6d96fbe
Compare
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
❌ Deploy Preview for vue-sfc-playground failed. Why did it fail? →
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/compiler-vapor
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/runtime-vapor
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
Sorry to bother again — I've rebased the PR onto the |
@9romise I think I have a proof of concept for replacing the cleanup array with the abort listener: OrbisK@a5a6a07. The benchmarks are mixed. Maybe you could take a look? |
Awesome! Thanks a lot for your work! I actually gave it a try before rebasing onto the |
Go ahead if you have time. I am on holiday for two weeks. 😅 |
This PR introduces a lazy-initialized signal getter on EffectScope.
scope.signal
is accessed for the first time, anAbortController
will be created and itsAbortSignal
returned.scope.signal
is never accessed, no controller will be created, avoiding unnecessary overhead.scope.stop()
is called, if anAbortController
exists, it will automatically triggercontroller.abort()
.Related: #13861 (comment), #13861 (comment)
/cc @ferferga, @OrbisK, @antfu