-
-
Notifications
You must be signed in to change notification settings - Fork 9k
fix(custom-element): prevent parse slot when custom element move in DOM #13164
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
edison1105
commented
Apr 5, 2025
thanks for the PR.could you please add a test ?
Size ReportBundles
Usages
|
@vue/compiler-core
npm i https://pkg.pr.new/@vue/compiler-core@13164
@vue/compiler-dom
npm i https://pkg.pr.new/@vue/compiler-dom@13164
@vue/compiler-ssr
npm i https://pkg.pr.new/@vue/compiler-ssr@13164
@vue/compiler-sfc
npm i https://pkg.pr.new/@vue/compiler-sfc@13164
@vue/runtime-core
npm i https://pkg.pr.new/@vue/runtime-core@13164
@vue/reactivity
npm i https://pkg.pr.new/@vue/reactivity@13164
@vue/runtime-dom
npm i https://pkg.pr.new/@vue/runtime-dom@13164
@vue/server-renderer
npm i https://pkg.pr.new/@vue/server-renderer@13164
@vue/shared
npm i https://pkg.pr.new/@vue/shared@13164
@vue/compat
npm i https://pkg.pr.new/@vue/compat@13164
vue
npm i https://pkg.pr.new/vue@13164
commit: 7f66fe6
@edison1105
edison1105
added
need test
The PR has missing test cases.
scope: custom elements
labels
Apr 6, 2025
Contributor
skirtles-code
commented
Jun 3, 2025
I'm wondering whether this is the same issue that was fixed by #13201, released in Vue 3.5.15?
@edison1105
edison1105
changed the title
(削除) fix(custom-element): prevent parse slot when custom elemnt move in DOM (削除ここまで)
(追記) fix(custom-element): prevent parse slot when custom element move in DOM (追記ここまで)
Jun 7, 2025
Member
edison1105
commented
Jun 11, 2025
Thanks for the PR.
Closing as fixed via #13201
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bug Report: Component Disappears When Moved in DOM Using Custom Element with Slot
Description
I'm using a Custom Element to wrap a Vue component that includes a
slot. In this setup,shadowRootis set tofalse.The issue I'm encountering is that when I move this element within the DOM — either by dragging it or using
appendChildto insert it elsewhere — thedisconnectedCallbackis triggered.Inside the
disconnectedCallback,nextTickis used. However, beforenextTickgets a chance to execute, theconnectedCallbackis triggered again. As a result,_parseSlotsis called before the component is fully re-initialized, and allchildNodesinside the element are removed. This causes the component to suddenly disappear from the DOM.Temporary Fix
To resolve this issue, I added a check to ensure
_instanceis notnullbefore calling_parseSlots. This workaround prevents the unexpected removal of slot content.Reproduction
If needed, I can provide a minimal reproduction of the problem.
Environment
shadowRoot: falseExpected Behavior
Moving the component in the DOM should not cause it to lose its slotted children or disappear.
Actual Behavior
Slotted content is removed when the component is reconnected before
nextTickexecutes.Let me know if a repro is needed — I’d be happy to provide one.