Skip to content

Commit fb3c305

Browse files
committed
fix(patch): clone insert hooks to avoid being mutated during iteration
1 parent 2e57061 commit fb3c305

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/core/vdom/patch.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -878,8 +878,11 @@ export function createPatchFunction(backend) {
878878
const insert = ancestor.data.hook.insert
879879
if (insert.merged) {
880880
// start at index 1 to avoid re-invoking component mounted hook
881-
for (let i = 1; i < insert.fns.length; i++) {
882-
insert.fns[i]()
881+
// clone insert hooks to avoid being mutated during iteration.
882+
// e.g. for customed directives under transition group.
883+
const cloned = insert.fns.slice(1)
884+
for (let i = 0; i < cloned.length; i++) {
885+
cloned[i]()
883886
}
884887
}
885888
} else {

0 commit comments

Comments
 (0)