Skip to content

Commit 07fd7e4

Browse files
committed
fix(runtime-vapor): properly handle fast remove in keyed diff
1 parent 348ffaf commit 07fd7e4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/runtime-vapor/src/apiCreateFor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ export const createFor = (
256256
const previousKeyIndexMap = new Map(previousKeyIndexPairs)
257257
const operations: (() => void)[] = []
258258

259+
let mountCounter = 0
259260
const relocateOrMountBlock = (
260261
blockIndex: number,
261262
blockItem: ReturnType<typeof getItem>,
@@ -280,6 +281,7 @@ export const createFor = (
280281
)
281282
}
282283
} else {
284+
mountCounter++
283285
operations.push(() =>
284286
mount(
285287
source,
@@ -310,7 +312,7 @@ export const createFor = (
310312
relocateOrMountBlock(i, blockItem, blockKey, -1)
311313
}
312314

313-
const useFastRemove = operations.length === newLength
315+
const useFastRemove = mountCounter === newLength
314316

315317
for (const leftoverIndex of previousKeyIndexMap.values()) {
316318
unmount(

0 commit comments

Comments
 (0)