polish(teleport): do not warn missing target when teleport is disabled (#2021)
This commit is contained in:
@@ -14,7 +14,7 @@ import { warn } from '../warning'
|
||||
export type TeleportVNode = VNode<RendererNode, RendererElement, TeleportProps>
|
||||
|
||||
export interface TeleportProps {
|
||||
to: string | RendererElement
|
||||
to: string | RendererElement | null | undefined
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ const resolveTarget = <T = RendererElement>(
|
||||
return target as any
|
||||
}
|
||||
} else {
|
||||
if (__DEV__ && !targetSelector) {
|
||||
if (__DEV__ && !targetSelector && !isTeleportDisabled(props)) {
|
||||
warn(`Invalid Teleport target: ${targetSelector}`)
|
||||
}
|
||||
return targetSelector as any
|
||||
@@ -94,7 +94,7 @@ export const TeleportImpl = {
|
||||
const targetAnchor = (n2.targetAnchor = createText(''))
|
||||
if (target) {
|
||||
insert(targetAnchor, target)
|
||||
} else if (__DEV__) {
|
||||
} else if (__DEV__ && !disabled) {
|
||||
warn('Invalid Teleport target on mount:', target, `(${typeof target})`)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user