}
function resetShapeFlag(vnode: VNode) {
- let shapeFlag = vnode.shapeFlag
- if (shapeFlag & ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE) {
- shapeFlag -= ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE
- }
- if (shapeFlag & ShapeFlags.COMPONENT_KEPT_ALIVE) {
- shapeFlag -= ShapeFlags.COMPONENT_KEPT_ALIVE
- }
- vnode.shapeFlag = shapeFlag
+ // bitwise operations to remove keep alive flags
+ vnode.shapeFlag &= ~ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE
+ vnode.shapeFlag &= ~ShapeFlags.COMPONENT_KEPT_ALIVE
}
function getInnerChild(vnode: VNode) {
hmrDirtyComponents.has(n2.type as ConcreteComponent)
) {
// #7042, ensure the vnode being unmounted during HMR
- if (n1.shapeFlag & ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE) {
- n1.shapeFlag -= ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE
- }
- // #7042, ensure the vnode being mounted as fresh during HMR
- if (n2.shapeFlag & ShapeFlags.COMPONENT_KEPT_ALIVE) {
- n2.shapeFlag -= ShapeFlags.COMPONENT_KEPT_ALIVE
- }
+ // bitwise operations to remove keep alive flags
+ n1.shapeFlag &= ~ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE
+ n2.shapeFlag &= ~ShapeFlags.COMPONENT_KEPT_ALIVE
// HMR only: if the component has been hot-updated, force a reload.
return false
}