refactor: remove null comparisons

This commit is contained in:
Evan You
2020-03-18 18:14:51 -04:00
parent 811f28a7d1
commit ba9a91c48c
18 changed files with 104 additions and 119 deletions

View File

@@ -85,7 +85,7 @@ const KeepAliveImpl = {
queuePostRenderEffect(() => {
const component = vnode.component!
component.isDeactivated = false
if (component.a !== null) {
if (component.a) {
invokeHooks(component.a)
}
}, parentSuspense)
@@ -95,7 +95,7 @@ const KeepAliveImpl = {
move(vnode, storageContainer, null, MoveType.LEAVE, parentSuspense)
queuePostRenderEffect(() => {
const component = vnode.component!
if (component.da !== null) {
if (component.da) {
invokeHooks(component.da)
}
component.isDeactivated = true

View File

@@ -44,7 +44,7 @@ export const PortalImpl = {
const target = (n2.target = isString(targetSelector)
? querySelector!(targetSelector)
: targetSelector)
if (target != null) {
if (target) {
if (shapeFlag & ShapeFlags.TEXT_CHILDREN) {
setElementText(target, children as string)
} else if (shapeFlag & ShapeFlags.ARRAY_CHILDREN) {
@@ -93,7 +93,7 @@ export const PortalImpl = {
const nextTarget = (n2.target = isString(targetSelector)
? querySelector!(targetSelector)
: targetSelector)
if (nextTarget != null) {
if (nextTarget) {
// move content
if (shapeFlag & ShapeFlags.TEXT_CHILDREN) {
setElementText(target, '')

View File

@@ -536,7 +536,7 @@ export function queueEffectWithSuspense(
fn: Function | Function[],
suspense: SuspenseBoundary | null
): void {
if (suspense !== null && !suspense.isResolved) {
if (suspense && !suspense.isResolved) {
if (isArray(fn)) {
suspense.effects.push(...fn)
} else {