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: web components remount issue #922

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LetItRock
Copy link

Hello @Akryum! 👋

This PR fixes the issue that I've hit when using the Web Component as the popover content.

Steps to reproduce:

  1. Open --> popper node is added to the container --> will call connectedCallback on the Web Component
  2. Close -->
  3. Open --> appendChild called --> popper node is removed and added to the container --> will call disconnectedCallback and connectedCallback on the Web Component

The thing is that appendChild moves the child from its current position to the new one if it was added to the container ref and that is exactly what is going on in the third step, and because of it the Web Component is disconnected and connected right away.
If the container already contains that popper node there is no reason to remove and add it again with appendChild call.

Tests passing. I've also verified if it works with the demo-vue3 app.

I'll appreciate it if we can merge it as it fixes the big issue for me. Thanks! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant