Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teleported multi-root child component elements are not being removed together with parent component #3156

Closed
Connum opened this issue Feb 3, 2021 · 0 comments · Fixed by #3157
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. 🐞 bug Something isn't working scope: teleport

Comments

@Connum
Copy link

Connum commented Feb 3, 2021

Version

3.0.5

Reproduction link

https://github.com/Connum/vue-teleport-multiroot-bug

Steps to reproduce

  1. Have a component <teleport> a child component with multiple root elements to somewhere in the body
  2. Trigger deletion of the parent component

What is expected?

All traces of the teleported child element are removed

What is actually happening?

The child component's elements remain in the body


Might be related to #1088

I tried looking into this myself, and it seems like there's an issue with the comment nodes - they are removed, but the actual element is not:
image
and after deletion:
image

I was able to seemingly fix this for my use case by extending runtime-core/src/renderer.ts like this:

if (type === Static || type === Comment) {
      removeStaticNode(vnode)
      return
}

But I also had to check for child not being null in the remove() functions in both NodeOpts.ts files (runtime-tests and runtime-dom), but now 8 tests are failing and I'm a bit stuck because obviously I don't know what I'm doing... 😉

@Connum Connum changed the title Transported multi-root child component elements are not being removed together with parent component Teleported multi-root child component elements are not being removed together with parent component Feb 3, 2021
@HcySunYang HcySunYang added 🐞 bug Something isn't working ❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. labels Feb 4, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
❗ p4-important Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf. 🐞 bug Something isn't working scope: teleport
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants