Procházet zdrojové kódy

fix(ref): store old value in RefImpl when value changes

daiwei před 9 měsíci
rodič
revize
51314388e9
1 změnil soubory, kde provedl 1 přidání a 0 odebrání
  1. 1 0
      packages/reactivity/src/ref.ts

+ 1 - 0
packages/reactivity/src/ref.ts

@@ -168,6 +168,7 @@ class RefImpl<T = any> implements ReactiveNode {
     if (hasChanged(newValue, oldValue)) {
     if (hasChanged(newValue, oldValue)) {
       this.flags |= _ReactiveFlags.Dirty
       this.flags |= _ReactiveFlags.Dirty
       this._rawValue = newValue
       this._rawValue = newValue
+      this._oldValue = oldValue
       this._value =
       this._value =
         !useDirectValue && this._wrap ? this._wrap(newValue) : newValue
         !useDirectValue && this._wrap ? this._wrap(newValue) : newValue
       const subs = this.subs
       const subs = this.subs