Skip to content

fix: name what to change when a fallback shown through fill fallback= cannot be placed - #468

Merged
JuroOravec merged 2 commits into
mainfrom
fix/fallback-slot-chains
Oct 28, 2026
Merged

JuroOravec merged 2 commits into
mainfrom
fix/fallback-slot-chains

Conversation

@JuroOravec

@JuroOravec JuroOravec commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

What this does

This PR improves three error messages for <c-fill fallback=...> in a component that uses Vue. Nothing that renders correctly changes. One shape that used to render without its fallback (item 3, with a transparent receiver) now fails with item 3's message.

1. A fallback whose <c-slot> sits in content passed to another component no longer fails with an internal message. It failed with "direct slot result moved across unrelated receivers: current='citryOccurrence…'", even when the fallback held only <i>x</i>. The issue lists two shapes:

  • Receiver puts its <c-slot name="body"> inside the content it passes to another component, Mid, and the caller shows that fallback through fallback=.
  • A middle component forwards its own <c-slot name="mid"> into a fill it gives Receiver, and the page shows mid's fallback through fallback=.

Both now fail with a message that names the caller, the receiver, the slot and the component the receiver passes its content to, and says what to change:

In a component that uses Vue, Caller shows the fallback of Receiver's 'body' slot through '', but Receiver puts that '' inside the content it passes to Mid, so Citry cannot place the fallback in Caller's template. Write the fallback content in Caller's fill itself, leave the slot unfilled so Receiver shows its own fallback, or move the '' out of the content Receiver passes to Mid.

The message fires only when the fill around the fallback is the caller's fill to this same receiver. Other states keep the internal message.

2. A captured Slot is no longer called a <c-slot> outlet. A fallback that prints a Slot it got from Python, such as {{ icon }} with icon = slots["icon"], was refused as "a '' outlet", although the author wrote no <c-slot> there. The error now says "a Slot value that it prints, such as one taken from slots". A printed nested template gets its own label too.

  • How: each slot render records whether a <c-slot> started it (from_outlet in _vue/direct.py); SlotNode sets it.
  • Cache: the flag is stored in the cache artifact (ext/cache/artifact.py, replay.py), so a replayed render gives the same message. Entries cached before this change no longer match the artifact's shape, so each is read as a miss and rendered again once. The artifact version stays 1.

3. A fallback printed inside a component that is not transparent no longer fails with an internal message. <c-fill name="body" fallback="fallback"><c-Wrap>{{ fallback }}</c-Wrap></c-fill> failed with "selected direct fills were not consumed by their receiver call", even for plain HTML. It now fails when the page renders, with:

In a component that uses Vue, Caller shows the fallback of Receiver's 'body' slot through '', but it puts that fallback inside Wrap's slot. Citry can show Receiver's fallback inside another component only when that component is transparent. Use an HTML element in place of Wrap, or mark Wrap with 'transparent = True' if it only wraps content. You can also write the fallback content in Caller's fill itself, or leave the slot unfilled so Receiver shows its own fallback.

  • How: the fallback handle (the Slot that fallback="..." names, printed as {{ fallback }}) normally lands in the outlet of the component that wrote the fallback. The check runs where Citry places slot content, in transform_parts (_vue/direct_capture.py), and fires when the handle lands in another component's outlet instead. It skips content that Citry copies in place for a transparent component, so a transparent Wrap still renders.
  • Nested components: the message names the innermost component that is not transparent. The fallback has to leave that one in any case, and an outer one gets its own error after that.
  • A wrapper that passes its slot on, such as Forward with <c-Inner><c-slot /></c-Inner>, now gets this message naming Forward. Before, it got item 1's message with the wrong component and slot names. When Forward is transparent, it gets item 1's message, which now names Forward as the component that passes the content on and uses the fallback's own slot name.
  • A transparent receiver: the shape used to render, but without the fallback content (an empty <span class="w">). It now fails with this message.
  • Cache: a replay used to rebuild the fallback's slot name from the outlet's slot (Wrap's default). The cache artifact now also stores the slot name the fill was written for, when it differs, so a replay names body too. As with from_outlet, older entries no longer match the artifact's shape and are rendered again once.

The docs note "Limits with Vue" in docs_site/content/concepts/slots.md now lists all three cases.

Not in this PR

  • Making these cases work. That covers an outlet, a captured Slot or a filled component inside such a fallback, and the shapes in item 1. It needs a design decision, so it waits. The design note recommends recording the receiver's slot choices in the caller's data and writing every branch into the caller's template, extending fix: let a fallback shown through <c-fill fallback=...> hold components #430's change, which already records the fallback's component calls there.
  • A fallback in a template-valued c- attribute inside the caller's fill, such as <c-Tpl c-tpl="<b>{{ fallback }}</b>" />, still fails with the internal "moved across unrelated receivers" message. It is a separate path and is left for option A.
  • Naming in fix: let a fallback shown through <c-fill fallback=...> hold components #430's message. describe_caller_fallback, fix: let a fallback shown through <c-fill fallback=...> hold components #430's message, still names the component a transparent caller lands in rather than the transparent component. Through a transparent Wrap it also names Wrap's slot ('default') instead of the fallback's own slot. The new messages in this PR name it correctly.

Tests

tests/test_vue_direct_relationships.py:

  • the captured Slot, both on a first render and replayed from the cache;
  • a printed template value;
  • both shapes in item 1;
  • a deeper chain, which checks that the message names the component the receiver passes its content to;
  • a fallback inside a component that is not transparent: directly, inside an HTML element, inside two nested components, and inside a wrapper that passes its slot on;
  • the same with a transparent receiver, and after a cache replay (which checks that the second render is a cache hit);
  • a transparent wrapper that passes its slot on, which gets item 1's message with the right names;
  • both fixes the message suggests (a transparent component, an HTML element), which render.

The tests match the part of each message that names the components or the content. The citry suite and the fallback and slot-props e2e tests pass.

Part of #429.

🤖 Generated with Claude Code

@JuroOravec
JuroOravec force-pushed the fix/fallback-slot-chains branch from 8fd3527 to 7af049d Compare October 27, 2026 19:15
… cannot be placed

In a component that uses Vue, <c-fill fallback=...> failed with the
internal message "direct slot result moved across unrelated receivers"
when the receiver puts the <c-slot> whose fallback is shown inside content
it passes to another component, even when the fallback held only plain
HTML. It now fails with a message that names the caller, the receiver,
the slot and the component the receiver passes its content to, and says
what to change. The message fires only when the fill around the fallback
is the caller's fill to that receiver.

A fallback that prints a Slot it received from Python, such as
{{ icon }}, was refused as "a '<c-slot>' outlet". Each slot render now
records whether a <c-slot> started it, the cache artifact stores that
flag so a replay gives the same message, and a printed nested template
gets its own label. The "Limits with Vue" docs note lists both cases.

Printing {{ fallback }} inside a component that is not transparent failed
with "selected direct fills were not consumed by their receiver call". It
now fails with a message that names the caller, the receiver, the slot and
the component around the fallback, and says what to change. The cache
artifact stores the fill's own slot name so a replay names the same slot.

Part of #429.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@JuroOravec
JuroOravec force-pushed the fix/fallback-slot-chains branch from 7af049d to 7f78f7d Compare October 27, 2026 19:15
@JuroOravec
JuroOravec merged commit a42662d into main Oct 28, 2026
0 of 30 checks passed
@JuroOravec
JuroOravec deleted the fix/fallback-slot-chains branch October 28, 2026 10:53
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.

1 participant