-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Check Svelte component instance is detached or not from the document after a microtask tick. #10454
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
Labels
Comments
Makes sense, PR welcome! |
Some more context and steps to reproduce:
Misbehaviour in both cases doesn't occur if you wait a tick after first DOM attachment:
|
dummdidumm
pushed a commit
that referenced
this issue
Feb 13, 2024
dummdidumm
added a commit
that referenced
this issue
Feb 13, 2024
5 tasks
dummdidumm
added a commit
that referenced
this issue
Feb 15, 2024
hardl
added a commit
to hardl/svelte
that referenced
this issue
May 6, 2024
This was referenced May 6, 2024
dummdidumm
pushed a commit
that referenced
this issue
May 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Currently we dealing with incorporating of Svelte component in out big application and at this point I've noticed that Svelte mount several components under shadow dom.
Looking at this issue with duplicate mounts I've tracked to
svelte/packages/svelte/src/internal/client/custom-element.js
Line 92 in 1366932
here we check this.$$cn and this.$$c but after a tick we refer to this.$$cn only
I've slightly modified this part to recheck both this.$$c and this.$$cn after a tick like this
and not I don't see any duplicate components.
My strong believe is that we should check both this.$$c and this.$$cn after a tick and seems like we have an issue here?
Reproduction
no exact steps.
Issue is observable with complex application where we have triggered many mounts/unmounts of the component
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: