Skip to content

Commit 9a936aa

Browse files
committed
feat(reactivity): add failSilently argument for onScopeDispose
1 parent ef2eaef commit 9a936aa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: packages/reactivity/src/effectScope.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ export function getCurrentScope() {
136136
* @param fn - The callback function to attach to the scope's cleanup.
137137
* @see {@link https://vuejs.org/api/reactivity-advanced.html#onscopedispose}
138138
*/
139-
export function onScopeDispose(fn: () => void) {
139+
export function onScopeDispose(fn: () => void, failSilently = false) {
140140
if (activeEffectScope) {
141141
activeEffectScope.cleanups.push(fn)
142-
} else if (__DEV__) {
142+
} else if (__DEV__ && !failSilently) {
143143
warn(
144144
`onScopeDispose() is called when there is no active effect scope` +
145145
` to be associated with.`,

0 commit comments

Comments
 (0)