// should update
await nextTick()
expect(el.innerHTML).toBe(`<div>3 3</div>`)
+
+ vm.ok = true
+ await nextTick()
+ vm.ok = false
+ await nextTick()
+ expect(el.innerHTML).toBe(`<div>3 3</div>`)
+
+ vm.y++
+ // should update
+ await nextTick()
+ expect(el.innerHTML).toBe(`<div>4 3</div>`)
})
test('on v-for', async () => {
* after initialized (e.g. inline handlers)
* @internal
*/
- renderCache: (Function | VNode)[]
+ renderCache: (Function | VNode | undefined)[]
/**
* Resolved component registry, only for components with mixins or extends
// shallow clone
ret.memo = memo.slice()
+ ret.memoIndex = index
+
return (cache[index] = ret)
}
shapeFlag,
patchFlag,
dirs,
+ memoIndex,
} = vnode
// unset ref
if (ref != null) {
setRef(ref, null, parentSuspense, vnode, true)
}
+ // #6593 should clean memo cache when unmount
+ if (memoIndex != null) {
+ parentComponent!.renderCache[memoIndex] = undefined
+ }
+
if (shapeFlag & ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE) {
;(parentComponent!.ctx as KeepAliveContext).deactivate(vnode)
return
* @internal attached by v-memo
*/
memo?: any[]
+ /**
+ * @internal index for cleaning v-memo cache
+ */
+ memoIndex?: number
/**
* @internal __COMPAT__ only
*/