Skip to content

fix(custom-element): ensure proper remount and prevent redundant slot parsing with shadowRoot false #13201

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

edison1105
Copy link
Member

close #13199

Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB (+4 B) 38.1 kB (+3 B) 34.3 kB (-11 B)
vue.global.prod.js 158 kB (+4 B) 58.3 kB (+3 B) 51.8 kB (-43 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.4 kB 18.1 kB 16.6 kB
createApp 54.4 kB 21.2 kB 19.4 kB
createSSRApp 58.6 kB 22.9 kB 20.9 kB
defineCustomElement 59.2 kB (+4 B) 22.7 kB (+1 B) 20.7 kB (+2 B)
overall 68.5 kB 26.3 kB 24 kB

Copy link

pkg-pr-new bot commented Apr 15, 2025

Open in StackBlitz

@vue/compiler-core

npm i https://pkg.pr.new/@vue/compiler-core@13201

@vue/compiler-dom

npm i https://pkg.pr.new/@vue/compiler-dom@13201

@vue/compiler-sfc

npm i https://pkg.pr.new/@vue/compiler-sfc@13201

@vue/compiler-ssr

npm i https://pkg.pr.new/@vue/compiler-ssr@13201

@vue/reactivity

npm i https://pkg.pr.new/@vue/reactivity@13201

@vue/runtime-core

npm i https://pkg.pr.new/@vue/runtime-core@13201

@vue/runtime-dom

npm i https://pkg.pr.new/@vue/runtime-dom@13201

@vue/server-renderer

npm i https://pkg.pr.new/@vue/server-renderer@13201

@vue/shared

npm i https://pkg.pr.new/@vue/shared@13201

vue

npm i https://pkg.pr.new/vue@13201

@vue/compat

npm i https://pkg.pr.new/@vue/compat@13201

commit: 711e42b

@edison1105
Copy link
Member Author

/ecosystem-ci run

@vue-bot
Copy link
Contributor

vue-bot commented Apr 15, 2025

📝 Ran ecosystem CI: Open

suite result latest scheduled
radix-vue success success
nuxt success success
pinia success success
language-tools success success
test-utils success success
quasar success success
router success success
primevue success success
vitepress success success
vue-simple-compiler success success
vueuse success success
vue-i18n success success
vite-plugin-vue success success
vuetify success failure
vant success success
vue-macros success success

@edison1105 edison1105 changed the title fix(custom-element): avoid re-parsing slots if already resolved fix(custom-element): ensure proper remount and prevent redundant slot parsing Apr 15, 2025
@edison1105 edison1105 changed the title fix(custom-element): ensure proper remount and prevent redundant slot parsing fix(custom-element): ensure proper remount and prevent redundant slot parsing with shadowRoot false Apr 15, 2025
@edison1105 edison1105 added ready to merge The PR is ready to be merged. 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: custom elements labels Apr 15, 2025
@@ -1131,6 +1131,92 @@ describe('defineCustomElement', () => {
expect(target.innerHTML).toBe(`<span>default</span>`)
app.unmount()
})

test('toggle nested custom element with shadowRoot: false', async () => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @edison1105 , thanks for the fix, it works fine in our app as well!

I'm not sure if it is related to the current issue or I need to create a separate one, but If in custom element slot we have a v-if clause, then it never renders even if the clause is true, but if it's v-show - it works fine.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want me to add a test case to this branch or I can create an issue.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please create new one, I will take a look later.

Copy link

@rbecheras rbecheras Apr 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for this @edison1105
The issue is created here #13206

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. ready to merge The PR is ready to be merged. scope: custom elements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[custom elements api] Cannot set properties of null (setting 'parent') with { shadowRoot: false }
4 participants