瀏覽代碼

refactor(runtime-vapor): remove shallowRef list for v-for (#281)

Rizumu Ayaka 1 年之前
父節點
當前提交
eda2a43f07
共有 1 個文件被更改,包括 1 次插入6 次删除
  1. 1 6
      packages/runtime-vapor/src/apiCreateFor.ts

+ 1 - 6
packages/runtime-vapor/src/apiCreateFor.ts

@@ -2,7 +2,6 @@ import {
   type EffectScope,
   type EffectScope,
   type ShallowRef,
   type ShallowRef,
   effectScope,
   effectScope,
-  isReactive,
   shallowRef,
   shallowRef,
 } from '@vue/reactivity'
 } from '@vue/reactivity'
 import { isArray, isObject, isString } from '@vue/shared'
 import { isArray, isObject, isString } from '@vue/shared'
@@ -325,11 +324,7 @@ export const createFor = (
   ) {
   ) {
     const [item, key, index] = block.state
     const [item, key, index] = block.state
     let needsUpdate =
     let needsUpdate =
-      newItem !== item.value ||
-      newKey !== key.value ||
-      newIndex !== index.value ||
-      // shallowRef list
-      (isObject(newItem) && !isReactive(newItem))
+      newItem !== item.value || newKey !== key.value || newIndex !== index.value
     if (needsUpdate) updateState(block, newItem, newKey, newIndex)
     if (needsUpdate) updateState(block, newItem, newKey, newIndex)
   }
   }