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

fix(teleport): targetAnchor should also be removed when unmounted #2870

Merged
merged 2 commits into from
Mar 23, 2021
Merged

fix(teleport): targetAnchor should also be removed when unmounted #2870

merged 2 commits into from
Mar 23, 2021

Conversation

leaon4
Copy link
Contributor

@leaon4 leaon4 commented Dec 23, 2020

see test case

hostRemove(anchor!)
hostRemove(targetAnchor!)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here should check the target existence, because it only insert when has vaild target.

@leaon4
Copy link
Contributor Author

leaon4 commented Dec 25, 2020

Thank you, you're right.
Because of your suggestion, I reconsidered four situations of Teleport's props, , and then found more.
h(teleport, props, h('div'))

  1. props = {to: null, disabled: false} // illegal
  2. props = {to: null, disabled: true} // need to check target
  3. props = {to: target, disabled: false} // should remove targetAnchor but not
  4. props = {to: target, disabled: true} // should remove targetAnchor but not. Because when disabeld, it will not enter the method of remove.
    https://github.com/vuejs/vue-next/blob/0a6105f8ce4fb6f91947fb9764aae8eec1aded10/packages/runtime-core/src/renderer.ts#L2040-L2046
    So I rewrite it.

@underfin
Copy link
Member

Good work :)

@LinusBorg
Copy link
Member

LinusBorg commented Jan 6, 2021

@underfin is this ready to be approved?

@HcySunYang HcySunYang added the 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. label Mar 19, 2021
@LinusBorg LinusBorg merged commit 21d1288 into vuejs:master Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: teleport
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants