We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ef2eaef commit 9a936aaCopy full SHA for 9a936aa
packages/reactivity/src/effectScope.ts
@@ -136,10 +136,10 @@ export function getCurrentScope() {
136
* @param fn - The callback function to attach to the scope's cleanup.
137
* @see {@link https://vuejs.org/api/reactivity-advanced.html#onscopedispose}
138
*/
139
-export function onScopeDispose(fn: () => void) {
+export function onScopeDispose(fn: () => void, failSilently = false) {
140
if (activeEffectScope) {
141
activeEffectScope.cleanups.push(fn)
142
- } else if (__DEV__) {
+ } else if (__DEV__ && !failSilently) {
143
warn(
144
`onScopeDispose() is called when there is no active effect scope` +
145
` to be associated with.`,
0 commit comments