Skip to content

Commit

Permalink
refactor(runtime-vapor): remove support of shallowRef in v-for
Browse files Browse the repository at this point in the history
Co-authored-by: Rizumu Ayaka <[email protected]>
  • Loading branch information
sxzz and LittleSound committed Sep 27, 2024
1 parent c366948 commit b962aa5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
2 changes: 1 addition & 1 deletion packages/runtime-vapor/__tests__/for.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ describe('createFor', () => {
expect(host.innerHTML).toBe('<!--for-->')
})

test('shallowRef source', async () => {
test.fails('shallowRef source', async () => {
const list = shallowRef([{ name: '1' }, { name: '2' }, { name: '3' }])
const setList = (update = list.value.slice()) => (list.value = update)
function reverse() {
Expand Down
5 changes: 0 additions & 5 deletions packages/runtime-vapor/src/apiCreateFor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,9 @@ function updateState(
newIndex: number | undefined,
) {
const [item, key, index] = block.state
const oldItem = item.value
item.value = newItem
key.value = newKey
index.value = newIndex

if (oldItem === newItem && !isReactive(oldItem)) {
triggerRef(item)
}
}

export function createForSlots(
Expand Down

0 comments on commit b962aa5

Please sign in to comment.