Skip to content

fix(server-renderer): render cloneVNode attrs on vapor slot content (#16269) - #16272

Closed
zhengdaodeguL wants to merge 1 commit into
vuejs:minorfrom
zhengdaodeguL:fix/ssr-clonevnode-vapor-slot-attrs-16269
Closed

zhengdaodeguL wants to merge 1 commit into
vuejs:minorfrom
zhengdaodeguL:fix/ssr-clonevnode-vapor-slot-attrs-16269

Conversation

@zhengdaodeguL

Copy link
Copy Markdown

Fixes #16269.

A VDOM component that clones the first vnode of its default slot with extra attrs (cloneVNode(slots.default()[0], { class: 'trigger', 'aria-expanded': 'false' })) loses those attrs in SSR when the slot comes from a <script setup vapor> parent: the server renders a bare <button>hello</button>, the client expects the extras, and hydration reports a class mismatch. After hydration the attrs stay missing until their value changes.

Root cause: the server-side wrapper for slots from a Vapor component created a VaporSlot vnode but did not initialize its vs.props / vs.attrs metadata the way the client interop wrapper does. cloneVNode therefore kept the extra attrs only on the outer vnode props, where the Vapor SSR path ignores them.

This PR:

  • Initializes that metadata in the SSR slot wrapper (render.ts), mirroring the client interop wrapper (vs.props = vnode.props, key-only vnode.props, vs.attrs = EMPTY_OBJ).
  • Threads nonempty vs.attrs through the Vapor outlet path as slotAttrs.
  • In ssrRenderSlot, when slotAttrs is present, renders the slot to vnodes and merges the attrs onto the single root with cloneVNode. Ordinary slots keep the existing buffered SSR path, so client behavior and non-Vapor SSR output are unchanged.

Test: added a case to ssrVaporSlotRuntimes.spec.ts (a VDOM child renders cloneVNode attrs on vapor slot content). Before the fix it renders <button>hello</button>; after, <button class="trigger" aria-expanded="false">hello</button>.

Validation: vp test on ssrVaporSlotRuntimes.spec.ts, ssrSlot.spec.ts, and render.spec.ts — 267 passed; vp run check, vp lint, and vp fmt --check pass on the changed files.

Closes #16269

@coderabbitai

coderabbitai Bot commented Nov 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f0ed61de-29b5-443f-a7be-7e01f62390b5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@edison1105

Copy link
Copy Markdown
Member

closing in favor of #16340

@edison1105 edison1105 closed this Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants