Skip to content

Commit

Permalink
fix(teleport): do not throw target warning when teleport is disabled (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Leopoldthecoder authored May 30, 2024
1 parent cdb1d17 commit 15ee43f
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions packages/runtime-core/src/components/Teleport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,13 @@ const resolveTarget = <T = RendererElement>(
return null
} else {
const target = select(targetSelector)
if (!target) {
__DEV__ &&
warn(
`Failed to locate Teleport target with selector "${targetSelector}". ` +
`Note the target element must exist before the component is mounted - ` +
`i.e. the target cannot be rendered by the component itself, and ` +
`ideally should be outside of the entire Vue component tree.`,
)
if (__DEV__ && !target && !isTeleportDisabled(props)) {
warn(
`Failed to locate Teleport target with selector "${targetSelector}". ` +
`Note the target element must exist before the component is mounted - ` +
`i.e. the target cannot be rendered by the component itself, and ` +
`ideally should be outside of the entire Vue component tree.`,
)
}
return target as T
}
Expand Down

0 comments on commit 15ee43f

Please sign in to comment.