Skip to content

fix: let a fallback shown through <c-fill fallback=...> hold components - #430

Merged
JuroOravec merged 2 commits into
mainfrom
fix/fill-fallback-components
Oct 27, 2026
Merged

JuroOravec merged 2 commits into
mainfrom
fix/fill-fallback-components

Conversation

@JuroOravec

@JuroOravec JuroOravec commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Part of #351. The rest is in #429.

In a component that uses Vue, <c-fill fallback="fallback"> lets a caller's fill show the receiving component's slot fallback. The caller's template compiles that fallback. A component call in it was recorded in the receiver's data, which the caller's template does not read, so such a fallback raised an error.

What changes

  • The component calls in that fallback are now recorded in the caller's data, with the receiver still as each child's parent. Keyed loops, <c-provide> and transparent components in the fallback work the same way (packages/py/citry/citry/_vue/direct_capture.py).
  • Some content in that fallback needs something only the receiver has. It now raises an error that names the caller, the receiver, the slot and the content:
  • The last item fixes a bug that is already on main for plain elements. <i :class="message"> in that fallback read the caller's Vue data, and <b @c-click="go"> ran the caller's handler named go (or did nothing when the caller had none), with no error. The walk over the fallback now uses the same check that already refuses a fill copied outside its author (browser_read_trackers). A binding that reads no Vue data, such as :title="'fixed'", and c- inputs such as c-title still work.
  • docs_site/content/concepts/slots.md gets a "Limits with Vue" note in "Wrap the fallback". In the CHANGELOG, the refusal of Vue bindings and @c- handlers is a new "Changed" entry that says how to fix affected templates. The "Fixes" bullet covers the components, and the captured-Slot fix that shared that bullet now has its own.

Tests

  • tests/test_vue_direct_relationships.py:
    • test_a_fallback_shown_by_a_fill_shows_its_components covers 8 kinds of content, each with and without receiver js;
    • test_a_fallback_shown_by_a_fill_refuses_content_that_needs_the_receiver covers 10 cases (outlet, filled component, bindings and handlers on elements and components, ref, an assignment, and bindings inside a transparent component) and checks the full start of the message;
    • test_a_fill_that_shows_the_fallback_keeps_its_own_vue_bindings checks that the caller's own bindings around {{ fallback }} still work.
    • This replaces test_a_fallback_shown_by_a_fill_cannot_hold_a_component, which locked in the old error.
  • tests/e2e/test_fill_fallback_components_e2e.py (new) checks four things in a browser: hydration with no mismatch, the child reacting to a click, an Events render of the caller showing a new child in the fill, and an Events render of the receiver alone showing its own fallback.

Evidence

Run locally with the installed citry_core, which is newer than this branch's base:

  • citry and citry_ui suites, without e2e: 10,122 passed and 4 failed. The same 4 fail on the base commit with this extension. They are the small-stack thread tests in test_native_render_leaf_json.py and test_vue_hydration_regions.py, plus test_a_v_pre_elements_colon_attribute_is_written_on_the_server.
  • citry e2e: 345 passed.
  • ruff check, ruff format, mypy, mypy with --platform linux, and scripts/validate.py all pass.
  • The JS phases were not run, because this change touches no JS. PR CI runs the cargo phases.

Two independent reviews with a prose pass, plus a docs cold read, were folded in.

🤖 Generated with Claude Code

In a component that uses Vue, <c-fill fallback="fallback"> lets a
caller's fill show the receiving component's slot fallback. The caller's
template compiles that fallback and reads its values from the caller's
data. A component call in it was recorded in the receiver's data, which
that template does not read, so such a fallback raised an error.

The calls in that fallback are now recorded in the data of the component
whose template compiles it, the caller, with the receiver still as each
child's parent. Components inside a keyed loop, a `<c-provide>`, or
another transparent component in that fallback work the same way.

Some content in that fallback needs something only the receiver has, so
it raises an error that names the caller, the receiver and the slot:

- a `<c-slot>` outlet, which would choose its content from the
  receiver's slots;
- a component given fill content, which would be passed on through a
  slot in the caller's template;
- a Vue binding that reads Vue data, or a `@c-` event handler, on an
  element or a component. Compiled in the caller's template, such a
  binding read the caller's Vue data, and a click ran the caller's
  handler of the same name, or did nothing when the caller had none.
  The walk over the fallback now uses the same check that refuses a
  fill copied outside its author.

Part of #351. Slot outlets and components given fill content in that
fallback are left for #429.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@JuroOravec
JuroOravec merged commit 1c15db2 into main Oct 27, 2026
17 of 28 checks passed
@JuroOravec
JuroOravec deleted the fix/fill-fallback-components branch October 27, 2026 12:11
JuroOravec added a commit that referenced this pull request Oct 28, 2026
A PR merged while its checks were still queued kept those runs, and
they ran in full after the merge: about 300 to 400 job-minutes each for
#430, #435, #436 and #437, while the merge's own run on main tested the
same change again. Every check workflow that runs on pull requests now
also starts on the PR's `closed` event. That run joins the PR's
concurrency group, whose cancel-in-progress cancels the PR's queued and
running checks, and every job skips on that event, so the cancelling run
itself needs no runner.

The notification and relock workflows are left out because they run no
checks. A test checks each check workflow's trigger types and that every
job that can start a run skips on `closed`.

This is step 1 of the #405 proposal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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