Repository navigation
fix(vue): let citry preview render components with Events - #626
Merged
Merged
Conversation
…root
`citry preview` wraps its page template in a `{{ page }}` root. A nested
template render that is not a component's own output joins the
enclosing occurrence's Vue template, and the document-shell check only
read that occurrence's top-level parts, so the doctype and head reached
the Vue compiler and failed it for any component with Events.
The check now looks through a lone nested non-component render and
narrows a copy of it, keeping its frame, to the body contents.
Fixes #580.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The whitespace a multi-line wrapper template writes around `{{ page }}`
arrives as a run of static markup, which stopped the walk down to the
page. Skip whitespace-only static runs too, cover a multi-line wrapper
and a wrapper component in the test, and tighten the docstring and
changelog wording.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
JuroOravec
force-pushed
the
fix/580-preview-events
branch
from
November 14, 2026 13:39
d41060b to
66833cf
Compare
JuroOravec
marked this pull request as ready for review
November 14, 2026 13:39
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.
Fixes #580.
What was wrong
citry previewfailed for any component that uses Events. The preview page passes its page template into a small{{ page }}root template. When Events are on, Citry compiles the page into Vue templates, and a nested template render that is not a component's own output is compiled into the enclosing component's Vue template. Citry checks for a whole-page template so that only the<body>contents reach the Vue compiler, but that check only read the parts at the top level of each Vue template. The nested page's<!doctype>and<head>therefore reached the compiler, which rejected them.The fix
_logical_typed_bodyincitry/_vue/direct_capture.pynow looks inside a lone nested render when the top level holds no page shell, skipping whitespace around it. If the nested render holds a shell, the function returns a copy of that render with the same render frame (render id and owner), holding only the body contents. The server still writes the doctype and head from the full render, as it already did for nested renders.Cases that still fail as before, with the same Vue compile error: content beside
{{ page }}(such as a comment), and a whole page passed as a component's slot fill.Checks
{{ page }}root with a whole-page template (one-line wrapper, multi-line wrapper, wrapper component), and a preview of a component with Events served through the preview route. They fail without the fix.packages/py/citry/citry, also with--platform linux.PreviewServer: the preview renders, the app mounts once, two clicks run the Events handler and update the count to 2, and the console shows no errors.🤖 Generated with Claude Code