diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d831fa047c..4c75474b8d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## [2.7.13](https://github.com/vuejs/vue/compare/v2.7.12...v2.7.13) (2022-10-14) + + +### Bug Fixes + +* **effectScope:** calling off() of a detached scope should not break currentScope ([800207c](https://github.com/vuejs/vue/commit/800207c473c7d6dfcdc883100a3d443fc5ad2e39)), closes [#12825](https://github.com/vuejs/vue/issues/12825) +* **types:** style attribute svg ([#12800](https://github.com/vuejs/vue/issues/12800)) ([8e26261](https://github.com/vuejs/vue/commit/8e262618cdc3251ca9630b17de4a000567ffb007)) +* **watch:** avoid traversing objects that are marked non-reactive ([#12806](https://github.com/vuejs/vue/issues/12806)) ([5960f05](https://github.com/vuejs/vue/commit/5960f05c69099c174062b6672c7a21d717a3bccf)) + + + ## [2.7.12](https://github.com/vuejs/vue/compare/v2.7.11...v2.7.12) (2022-10-12) diff --git a/package.json b/package.json index 2bb114433f4..33eff56cac0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue", - "version": "2.7.12", + "version": "2.7.13", "packageManager": "pnpm@7.1.0", "description": "Reactive, component-oriented view layer for modern web interfaces.", "main": "dist/vue.runtime.common.js", diff --git a/packages/compiler-sfc/package.json b/packages/compiler-sfc/package.json index e8ee4ecf382..5159c5cce04 100644 --- a/packages/compiler-sfc/package.json +++ b/packages/compiler-sfc/package.json @@ -1,6 +1,6 @@ { "name": "@vue/compiler-sfc", - "version": "2.7.12", + "version": "2.7.13", "description": "compiler-sfc for Vue 2", "main": "dist/compiler-sfc.js", "types": "dist/compiler-sfc.d.ts", diff --git a/packages/server-renderer/package.json b/packages/server-renderer/package.json index cfda873a1c8..194d6e9f765 100644 --- a/packages/server-renderer/package.json +++ b/packages/server-renderer/package.json @@ -1,6 +1,6 @@ { "name": "vue-server-renderer", - "version": "2.7.12", + "version": "2.7.13", "description": "server renderer for Vue 2.0", "main": "index.js", "types": "types/index.d.ts", diff --git a/packages/template-compiler/package.json b/packages/template-compiler/package.json index fd22b64d90b..79515498d03 100644 --- a/packages/template-compiler/package.json +++ b/packages/template-compiler/package.json @@ -1,6 +1,6 @@ { "name": "vue-template-compiler", - "version": "2.7.12", + "version": "2.7.13", "description": "template compiler for Vue 2.0", "main": "index.js", "unpkg": "browser.js", diff --git a/src/core/observer/traverse.ts b/src/core/observer/traverse.ts index 5f4e378b194..c681e0c9285 100644 --- a/src/core/observer/traverse.ts +++ b/src/core/observer/traverse.ts @@ -21,6 +21,7 @@ function _traverse(val: any, seen: SimpleSet) { const isA = isArray(val) if ( (!isA && !isObject(val)) || + val.__v_skip /* ReactiveFlags.SKIP */ || Object.isFrozen(val) || val instanceof VNode ) { diff --git a/src/v3/reactivity/effectScope.ts b/src/v3/reactivity/effectScope.ts index 2ba50cd9ca8..f60e5fccf23 100644 --- a/src/v3/reactivity/effectScope.ts +++ b/src/v3/reactivity/effectScope.ts @@ -16,9 +16,7 @@ export class EffectScope { * @internal */ cleanups: (() => void)[] = [] - /** - * only assigned by undetached scope * @internal */ parent: EffectScope | undefined @@ -38,9 +36,9 @@ export class EffectScope { */ private index: number | undefined - constructor(detached = false) { + constructor(public detached = false) { + this.parent = activeEffectScope if (!detached && activeEffectScope) { - this.parent = activeEffectScope this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push( this @@ -93,7 +91,7 @@ export class EffectScope { } } // nested scope, dereference from parent to avoid memory leaks - if (this.parent && !fromParent) { + if (!this.detached && this.parent && !fromParent) { // optimized O(1) removal const last = this.parent.scopes!.pop() if (last && last !== this) { @@ -101,6 +99,7 @@ export class EffectScope { last.index = this.index! } } + this.parent = undefined this.active = false } } diff --git a/test/unit/features/v3/reactivity/effectScope.spec.ts b/test/unit/features/v3/reactivity/effectScope.spec.ts index b82127cdc76..6b837e67cdc 100644 --- a/test/unit/features/v3/reactivity/effectScope.spec.ts +++ b/test/unit/features/v3/reactivity/effectScope.spec.ts @@ -279,4 +279,15 @@ describe('reactivity/effectScope', () => { expect(getCurrentScope()).toBe(currentScope) }) }) + + it('calling .off() of a detached scope inside an active scope should not break currentScope', () => { + const parentScope = new EffectScope() + + parentScope.run(() => { + const childScope = new EffectScope(true) + childScope.on() + childScope.off() + expect(getCurrentScope()).toBe(parentScope) + }) + }) }) diff --git a/types/jsx.d.ts b/types/jsx.d.ts index 85c9c1df23d..4924f4c643c 100644 --- a/types/jsx.d.ts +++ b/types/jsx.d.ts @@ -731,7 +731,7 @@ export interface SVGAttributes extends AriaAttributes, EventHandlers { * @see https://www.w3.org/TR/SVG/styling.html#ElementSpecificStyling */ class?: any - style?: string | CSSProperties + style?: StyleValue color?: string height?: Numberish