Skip to content

Commit

Permalink
refactor: memoIndex -> cacheIndex
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jul 13, 2024
1 parent aef8077 commit 2815531
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/runtime-core/src/helpers/withMemo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function withMemo(

// shallow clone
ret.memo = memo.slice()
ret.memoIndex = index
ret.cacheIndex = index

return (cache[index] = ret)
}
Expand Down
6 changes: 3 additions & 3 deletions packages/runtime-core/src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2109,7 +2109,7 @@ function baseCreateRenderer(
shapeFlag,
patchFlag,
dirs,
memoIndex,
cacheIndex,
} = vnode

if (patchFlag === PatchFlags.BAIL) {
Expand All @@ -2122,8 +2122,8 @@ function baseCreateRenderer(
}

// #6593 should clean memo cache when unmount
if (memoIndex != null) {
parentComponent!.renderCache[memoIndex] = undefined
if (cacheIndex != null) {
parentComponent!.renderCache[cacheIndex] = undefined
}

if (shapeFlag & ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE) {
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-core/src/vnode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export interface VNode<
/**
* @internal index for cleaning v-memo cache
*/
memoIndex?: number
cacheIndex?: number
/**
* @internal __COMPAT__ only
*/
Expand Down

0 comments on commit 2815531

Please sign in to comment.