Skip to content

Commit 01fdb51

Browse files
committed
chore: add comments
1 parent 87d1e5f commit 01fdb51

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/compiler-core/src/transforms/cacheStatic.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,12 @@ function walk(
219219
// #6978, #7138, #7114
220220
// a cached children array inside v-for can caused HMR errors since
221221
// it might be mutated when mounting the first item
222+
// #13221
223+
// fix memory leak in cached array:
224+
// cached vnodes get replaced by cloned ones during mountChildren,
225+
// which bind DOM elements. These DOM references persist after unmount,
226+
// preventing garbage collection. Array spread avoids mutating cached
227+
// array, preventing memory leaks.
222228
exp.needArraySpread = true
223229
return exp
224230
}

0 commit comments

Comments
 (0)