Repository navigation
feat(vue): write a v-slot fill's server HTML with the props its slot passes - #447
Merged
Merged
Conversation
…passes
The server renderer now reads a fill's slot function when it takes one
name or one flat object pattern, such as { $i18n, row, row: item,
key: citrySlotKey, ...rest }. It evaluates the props the outlet's
renderSlot passes with the outlet component's data and binds them as the
fill's locals, so a page whose rows come from js_data shows its v-slot
fills before Vue starts, and Vue adopts that HTML. A props object passed
on with v-bind is read through Vue's props helpers. A prop the server
cannot read binds as unknown, so only the parts that read it become
shells. A nested pattern or a default declines as slot-props; its names
still bind, as unknown, so shell contents never read an outer fill's value
of the same name.
Part of #168.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
JuroOravec
force-pushed
the
feat/vue-slot-props-ssr
branch
from
October 27, 2026 16:40
d981dfe to
6ef04f6
Compare
This was referenced Oct 27, 2026
JuroOravec
added a commit
that referenced
this pull request
Nov 1, 2026
…ver HTML (#447) (#563) Co-authored-by: Claude Opus 5.5 <[email protected]>
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
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.
What this does
Stacked on #445, which adds
<c-slot :row>and<c-fill v-slot>. Review that one first; this PR's diff is the commit on top.When the server writes a page's HTML for Vue to adopt, it now writes a
v-slotfill too, with the values its<c-slot>passes:The page now shows
<b>Apple</b>before Vue starts, and Vue adopts it. Before this change, the server left the fill's place empty, and Vue built the element around the component tag in the browser.How
The behavior change is in
crates/citry_vue_compiler/src/server_render.rs. The docs, the design plan, and thecitryandcitry_corechangelogs are updated to match.{ $citryI18nBinding, $i18n, row }and{ key: citrySlotKey, ...p }, and renames such as{ row: item }.renderSlotcall of the receiving component's<slot>, evaluated with that component's own data, and are bound as the fill's locals. A props object that a middle component passes on withv-bindis read through Vue's props helpers. Props built with_mergePropsmake every prop unknown.data()value or$i18n, binds as unknown. Only the parts of the fill that read it are left for the browser to build.slot-props), and Vue builds the element around the<c-slot>in the browser. The pattern's names still bind, as unknown, so that element's server HTML never reads an outer fill's value of the same name.What does not change
custom-hooks). So an i18n page still shows no server HTML for these fills; the{ $i18n, row }form is covered by a Rust test only.hydration.rsignores slot parameters, so the hydration anchors are unchanged.Tests
undefined, as in Vue), a nested pattern declined, a middle component passing the props object on, and nested fills that use the same name inside an element the browser builds.scripts/vue_render_parity/check.pyover these pages: 0 mismatches against Vue'srenderToString.Part of #168.
🤖 Generated with Claude Code