Repository navigation
fix(vue): add no v-citry-vue-owned marker inside v-pre - #514
Merged
Merged
Conversation
Vue compiles nothing under `v-pre`, so a `:value` or `:selected` there is a plain attribute, not a binding. Citry still added its `v-citry-vue-owned` marker to form controls there, and Vue wrote the marker into the page. One helper, `writes_vue_owned_marker`, now skips the marker for an element under `v-pre` (its own or an ancestor's) in the render assembler, the composer that builds a Vue template from a `PreparedView`, and the template that `citry check` compiles. The sweep for other places that treat Vue syntax under `v-pre` as live fixed three more in the same walk: - a transparent component with `#c-key` inside `v-pre` failed to compile, because its keyed `<template>` wrapper sat where Vue does not read it; its contents are now written as one block of HTML; - a `v-pre` element at the root of a component with `css_data()` failed to compile, because Citry adds the root attribute with a Vue binding; Citry now compiles that root itself, and an error names the reason when the root carries its own Vue attribute; - slot content copied to another component was refused when it held Vue attributes under `v-pre`; only `ref`, which Vue still reads, now counts. Closes #414. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 28, 2026
This was referenced Oct 28, 2026
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.
Closes #414.
What this fixes
In a component that uses Vue, a form control inside or carrying
v-pre(<input :value>,<option :selected>,<select>,<textarea>) got a strayv-citry-vue-ownedattribute in the page. Underv-pre, Vue reads the element as written, so:valuethere is plain text and owns nothing.A new helper,
writes_vue_owned_marker(tag, *, under_v_pre)in_vue/capture.py, decides whether to add the marker. Every walk that writes it now tracks whether the element hasv-preor sits inside one:direct_capture.py, the path that writes pages;static_template.py, the templatecitry checkcompiles;compiler.py, the composer that builds a Vue template from aPreparedView.No Rust change is needed: the Rust server renderer only handles the compiled directive, which no longer appears under
v-pre.Three sibling bugs, found by the sweep
Each of these failed on
main:v-pre(<c-provide #c-key>) raisedVueCompilerDiagnosticsError. Thev-preelement's contents are now written as one block of HTML.v-preat the root of a component withcss_data()raisedELEMENT_ATTRS_BINDING_MISMATCH, because Citry adds the root attribute through a Vue binding. Citry now compiles that root itself. If the root also carries its own Vue attribute, the error says the root is why, and suggests wrapping it. It says so only when that is the whole reason.:x,@xorv-textunderv-pre. Onlyref, which Vue 3.5 still registers underv-pre, now counts.Evidence
mainand passes now. They cover:<c-provide>;v-preblock;citry check/render parity;test_vue*.py,test_check*.py, markup lint, browser analysis and the render walkers.test_v_pre_form_controls_hydrate_without_an_ownership_marker, shows no hydration mismatch, with 2 markers in the DOM onmainand 0 now. The reviewer also hydrated 9 more cases in Chromium with no mismatch:css_data()roots,#c-key, nestedv-preand<input v-pre>.assemble_typed_rendermedian 42.67/41.92 ms against 42.48/41.91 ms).--platform linux.Not in this PR (found by the sweep)
v-prewhen a template loads, such asv-once,@click.bogusand<transition>.<slot>,<component is>,<teleport>and<keep-alive>insidev-preas live Vue, which Vue 3.5 does not.citry checkand the editor:browser_expressions()has nov-prefilter, so they report unknown variables for Vue expressions underv-pre.idlint: av-ifunderv-preis still treated as conditional.citry checkvs render: when Citry compiles av-preelement itself (because it holds Citry values), the check template still differs from the render. That predates this PR.🤖 Generated with Claude Code