Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@edison1105
Copy link
Member

@edison1105 edison1105 commented Nov 20, 2024

close #12438

during SSR rendering, the optimized parameter passed to initSlots is always false. The slots._ flag is lost when initSlots is called in setupComponent for the child component. This triggers the logic inside normalizeObjectSlots, resulting in slotFn returning an array that includes a comment node.

const ret = slotFn(
slotProps,
bufferedPush,
parentComponent,
slotScopeId ? ' ' + slotScopeId : '',
)
if (isArray(ret)) {

related commit 3d34f40#diff-56930a63772d2e89f19432918b9d6ed851ede4159b0d32404e0c1d8c159fec99R1232
SSR rendering does not need to patch slots, so there won't be an issue similar to #10870. Perhaps the optimized parameter can always be set to true.

@github-actions
Copy link

github-actions bot commented Nov 20, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB (+3 B) 38.1 kB (+2 B) 34.4 kB (+32 B)
vue.global.prod.js 158 kB (+3 B) 58.3 kB (+2 B) 51.9 kB (-37 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 46.4 kB (+3 B) 18.2 kB (+2 B) 16.6 kB (+6 B)
createApp 54.4 kB (+3 B) 21.2 kB (+2 B) 19.4 kB (-2 B)
createSSRApp 58.6 kB (+3 B) 22.9 kB (+2 B) 20.9 kB (+1 B)
defineCustomElement 59.2 kB (+3 B) 22.7 kB (+2 B) 20.7 kB (-2 B)
overall 68.5 kB (+3 B) 26.4 kB (+3 B) 24 kB (-50 B)

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 20, 2024

Open in StackBlitz

@vue/compiler-core

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

@vue/compiler-dom

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

@vue/compiler-sfc

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

@vue/compiler-ssr

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

@vue/reactivity

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

@vue/runtime-core

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

@vue/runtime-dom

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

@vue/server-renderer

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

@vue/shared

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

vue

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

@vue/compat

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

commit: 84c3ad0

@edison1105 edison1105 requested a review from Copilot November 20, 2024 02:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no suggestions.

@edison1105 edison1105 added ready to merge The PR is ready to be merged. scope: ssr 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels Nov 20, 2024
@edison1105 edison1105 changed the title fix(ssr): properly handle ssr slot and fallback fix(ssr): properly init slots during ssr rendering Nov 20, 2024
@JPeer264
Copy link

@edison1105 just wondering if there is any more work required. From my perspective this looks pretty promising.

@yyx990803 yyx990803 merged commit 2206cd2 into main May 2, 2025
15 checks passed
@yyx990803 yyx990803 deleted the edison/fix/12438 branch May 2, 2025 09:48
camc314 pushed a commit to camc314/core that referenced this pull request Sep 10, 2025
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: ssr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

slot with always-true condition is not rendered on ssr

4 participants