Skip to content

Commit

Permalink
fix(patch): clone insert hooks to avoid being mutated during iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaodemen committed Dec 19, 2022
1 parent 2e57061 commit fb3c305
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/vdom/patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -878,8 +878,11 @@ export function createPatchFunction(backend) {
const insert = ancestor.data.hook.insert
if (insert.merged) {
// start at index 1 to avoid re-invoking component mounted hook
for (let i = 1; i < insert.fns.length; i++) {
insert.fns[i]()
// clone insert hooks to avoid being mutated during iteration.
// e.g. for customed directives under transition group.
const cloned = insert.fns.slice(1)
for (let i = 0; i < cloned.length; i++) {
cloned[i]()
}
}
} else {
Expand Down

0 comments on commit fb3c305

Please sign in to comment.