fix: web components remount issue #922
Open
+4
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 the
container
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! 🙌