This PR fixes the issue that I've hit when using the Web Component as the popover content.
Steps to reproduce:
Open --> popper node is added to the container --> will call connectedCallback on the Web Component
Close -->
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 containerref 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! 🙌
Hello @Akryum! 👋
This PR fixes the issue that I've hit when using the Web Component as the popover content.
Steps to reproduce:
popper node
is added to thecontainer
--> will callconnectedCallback
on the Web ComponentappendChild
called -->popper node
is removed and added to thecontainer
--> will calldisconnectedCallback
andconnectedCallback
on the Web ComponentThe thing is that
appendChild
moves the child from its current position to the new one if it was added to thecontainer
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 thecontainer
already contains thatpopper node
there is no reason to remove and add it again withappendChild
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! 🙌