refactor: memoIndex -> cacheIndex

This commit is contained in:
Evan You 2024-07-13 21:05:06 +08:00
parent aef807746a
commit 2815531fd5
No known key found for this signature in database
GPG Key ID: 00E9AB7A6704CE0A
3 changed files with 5 additions and 5 deletions

View File

@ -15,7 +15,7 @@ export function withMemo(
// shallow clone // shallow clone
ret.memo = memo.slice() ret.memo = memo.slice()
ret.memoIndex = index ret.cacheIndex = index
return (cache[index] = ret) return (cache[index] = ret)
} }

View File

@ -2109,7 +2109,7 @@ function baseCreateRenderer(
shapeFlag, shapeFlag,
patchFlag, patchFlag,
dirs, dirs,
memoIndex, cacheIndex,
} = vnode } = vnode
if (patchFlag === PatchFlags.BAIL) { if (patchFlag === PatchFlags.BAIL) {
@ -2122,8 +2122,8 @@ function baseCreateRenderer(
} }
// #6593 should clean memo cache when unmount // #6593 should clean memo cache when unmount
if (memoIndex != null) { if (cacheIndex != null) {
parentComponent!.renderCache[memoIndex] = undefined parentComponent!.renderCache[cacheIndex] = undefined
} }
if (shapeFlag & ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE) { if (shapeFlag & ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE) {

View File

@ -243,7 +243,7 @@ export interface VNode<
/** /**
* @internal index for cleaning v-memo cache * @internal index for cleaning v-memo cache
*/ */
memoIndex?: number cacheIndex?: number
/** /**
* @internal __COMPAT__ only * @internal __COMPAT__ only
*/ */