Skip to content

Commit 15ee43f

Browse files
fix(teleport): do not throw target warning when teleport is disabled (#9818)
1 parent cdb1d17 commit 15ee43f

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

packages/runtime-core/src/components/Teleport.ts

+7-8
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,13 @@ const resolveTarget = <T = RendererElement>(
4747
return null
4848
} else {
4949
const target = select(targetSelector)
50-
if (!target) {
51-
__DEV__ &&
52-
warn(
53-
`Failed to locate Teleport target with selector "${targetSelector}". ` +
54-
`Note the target element must exist before the component is mounted - ` +
55-
`i.e. the target cannot be rendered by the component itself, and ` +
56-
`ideally should be outside of the entire Vue component tree.`,
57-
)
50+
if (__DEV__ && !target && !isTeleportDisabled(props)) {
51+
warn(
52+
`Failed to locate Teleport target with selector "${targetSelector}". ` +
53+
`Note the target element must exist before the component is mounted - ` +
54+
`i.e. the target cannot be rendered by the component itself, and ` +
55+
`ideally should be outside of the entire Vue component tree.`,
56+
)
5857
}
5958
return target as T
6059
}

0 commit comments

Comments
 (0)