refactor: remove null comparisons
This commit is contained in:
@@ -90,7 +90,7 @@ export function renderComponentRoot(
|
||||
result = cloneVNode(result, fallthroughAttrs)
|
||||
// If the child root node is a compiler optimized vnode, make sure it
|
||||
// force update full props to account for the merged attrs.
|
||||
if (result.dynamicChildren !== null) {
|
||||
if (result.dynamicChildren) {
|
||||
result.patchFlag |= PatchFlags.FULL_PROPS
|
||||
}
|
||||
} else if (__DEV__ && !accessedAttrs && result.type !== Comment) {
|
||||
@@ -109,7 +109,7 @@ export function renderComponentRoot(
|
||||
result = cloneVNode(result, { [parentScopeId]: '' })
|
||||
}
|
||||
// inherit directives
|
||||
if (vnode.dirs != null) {
|
||||
if (vnode.dirs) {
|
||||
if (__DEV__ && !isElementRoot(result)) {
|
||||
warn(
|
||||
`Runtime directive used on component with non-element root node. ` +
|
||||
@@ -119,7 +119,7 @@ export function renderComponentRoot(
|
||||
result.dirs = vnode.dirs
|
||||
}
|
||||
// inherit transition data
|
||||
if (vnode.transition != null) {
|
||||
if (vnode.transition) {
|
||||
if (__DEV__ && !isElementRoot(result)) {
|
||||
warn(
|
||||
`Component inside <Transition> renders non-element root node ` +
|
||||
@@ -185,7 +185,7 @@ export function shouldUpdateComponent(
|
||||
}
|
||||
|
||||
// force child update on runtime directive usage on component vnode.
|
||||
if (nextVNode.dirs != null) {
|
||||
if (nextVNode.dirs) {
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -218,18 +218,18 @@ export function shouldUpdateComponent(
|
||||
} else if (!optimized) {
|
||||
// this path is only taken by manually written render functions
|
||||
// so presence of any children leads to a forced update
|
||||
if (prevChildren != null || nextChildren != null) {
|
||||
if (nextChildren == null || !(nextChildren as any).$stable) {
|
||||
if (prevChildren || nextChildren) {
|
||||
if (!nextChildren || !(nextChildren as any).$stable) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
if (prevProps === nextProps) {
|
||||
return false
|
||||
}
|
||||
if (prevProps === null) {
|
||||
return nextProps !== null
|
||||
if (!prevProps) {
|
||||
return !!nextProps
|
||||
}
|
||||
if (nextProps === null) {
|
||||
if (!nextProps) {
|
||||
return true
|
||||
}
|
||||
return hasPropsChanged(prevProps, nextProps)
|
||||
|
||||
Reference in New Issue
Block a user