From: Haoqun Jiang Date: Mon, 16 Aug 2021 22:19:06 +0000 (+0800) Subject: chore: rename `onDispose` to `onScopeDispose` in warnings and tests (#4355) X-Git-Tag: v3.2.3~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7c4e4514d166b2fcb055baa091a79d9244458ab5;p=thirdparty%2Fvuejs%2Fcore.git chore: rename `onDispose` to `onScopeDispose` in warnings and tests (#4355) --- diff --git a/packages/reactivity/__tests__/effectScope.spec.ts b/packages/reactivity/__tests__/effectScope.spec.ts index 6028882772..9eac6da1ac 100644 --- a/packages/reactivity/__tests__/effectScope.spec.ts +++ b/packages/reactivity/__tests__/effectScope.spec.ts @@ -173,7 +173,7 @@ describe('reactivity/effect/scope', () => { expect(doubled).toBe(undefined) }) - it('should fire onDispose hook', () => { + it('should fire onScopeDispose hook', () => { let dummy = 0 const scope = new EffectScope() @@ -192,7 +192,7 @@ describe('reactivity/effect/scope', () => { expect(dummy).toBe(7) }) - it('should warn onDispose() is called when there is no active effect scope', () => { + it('should warn onScopeDispose() is called when there is no active effect scope', () => { const spy = jest.fn() const scope = new EffectScope() scope.run(() => { @@ -204,7 +204,7 @@ describe('reactivity/effect/scope', () => { onScopeDispose(spy) expect( - '[Vue warn] onDispose() is called when there is no active effect scope to be associated with.' + '[Vue warn] onScopeDispose() is called when there is no active effect scope to be associated with.' ).toHaveBeenWarned() scope.stop() diff --git a/packages/reactivity/src/effectScope.ts b/packages/reactivity/src/effectScope.ts index 05a700be43..864443f85b 100644 --- a/packages/reactivity/src/effectScope.ts +++ b/packages/reactivity/src/effectScope.ts @@ -98,7 +98,7 @@ export function onScopeDispose(fn: () => void) { activeEffectScope.cleanups.push(fn) } else if (__DEV__) { warn( - `onDispose() is called when there is no active effect scope` + + `onScopeDispose() is called when there is no active effect scope` + ` to be associated with.` ) }