TypeError when unmounting Vue component with an unused Teleport #27180
Unanswered
MetRonnie
asked this question in
Component Testing
Replies: 1 comment
-
Seems to be a Vue issue where components are destroyed before being passed to More context: vuejs/core#9270 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem
I have a component that includes
In the component test I am just mounting the component without the parent component; the teleport is unused. However this results in a TypeError on unmount causing the next test to fail
TypeError: Cannot read properties of null (reading 'type')
TypeError: instance is null
Solution
Add a prop called something like
teleportTarget
which defaults tonull
, only passing in#element-in-parent-component
from the parent component. And add av-if
conditionThis way it doesn't bother trying to teleport during the component test
Beta Was this translation helpful? Give feedback.
All reactions