mirror of https://github.com/vuejs/core.git
chore(reactivity): effectScope.ts variable declarations optimized and remove useless code in effect.ts (#11721)
* chore(reactivity): effectScope.ts variable declarations optimized and remove useless code in effect.ts * fix(reactivity): batchDepth count error fixed * fix(reactivity): batchDepth count error fixed * chore(reactivity): modify the batchDepth increase type
This commit is contained in:
parent
47d81584a3
commit
64e1ca2657
|
@ -258,12 +258,10 @@ export function startBatch(): void {
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export function endBatch(): void {
|
export function endBatch(): void {
|
||||||
if (batchDepth > 1) {
|
if (--batchDepth > 0) {
|
||||||
batchDepth--
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
batchDepth--
|
|
||||||
let error: unknown
|
let error: unknown
|
||||||
while (batchedEffect) {
|
while (batchedEffect) {
|
||||||
let e: ReactiveEffect | undefined = batchedEffect
|
let e: ReactiveEffect | undefined = batchedEffect
|
||||||
|
|
|
@ -53,12 +53,13 @@ export class EffectScope {
|
||||||
pause(): void {
|
pause(): void {
|
||||||
if (this._active) {
|
if (this._active) {
|
||||||
this._isPaused = true
|
this._isPaused = true
|
||||||
|
let i, l
|
||||||
if (this.scopes) {
|
if (this.scopes) {
|
||||||
for (let i = 0, l = this.scopes.length; i < l; i++) {
|
for (i = 0, l = this.scopes.length; i < l; i++) {
|
||||||
this.scopes[i].pause()
|
this.scopes[i].pause()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let i = 0, l = this.effects.length; i < l; i++) {
|
for (i = 0, l = this.effects.length; i < l; i++) {
|
||||||
this.effects[i].pause()
|
this.effects[i].pause()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,12 +72,13 @@ export class EffectScope {
|
||||||
if (this._active) {
|
if (this._active) {
|
||||||
if (this._isPaused) {
|
if (this._isPaused) {
|
||||||
this._isPaused = false
|
this._isPaused = false
|
||||||
|
let i, l
|
||||||
if (this.scopes) {
|
if (this.scopes) {
|
||||||
for (let i = 0, l = this.scopes.length; i < l; i++) {
|
for (i = 0, l = this.scopes.length; i < l; i++) {
|
||||||
this.scopes[i].resume()
|
this.scopes[i].resume()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let i = 0, l = this.effects.length; i < l; i++) {
|
for (i = 0, l = this.effects.length; i < l; i++) {
|
||||||
this.effects[i].resume()
|
this.effects[i].resume()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue