ISSUE DESCRIPTION fix(atelierssr): v-show on a non-root element with an existing style…
- User
ISSUE DESCRIPTION
fix(atelier_ssr): v-show on a non-root element with an existing style attr/:style binding emits a duplicate style attribute, breaking display:none hiding
Location
crates/vize_atelier_ssr/src/codegen/element/plain.rs:490(process_v_show_on_elementunconditionally appends a standalonestyle="display: none;"chunk; its element param is unused)crates/vize_atelier_ssr/src/codegen/element/plain.rs:245-254(collect_element_directive_attr— the single-root/inherit_attrs path that correctly merges into one style binding via_mergeProps; reference for the fix)
Problem
process_v_show_on_element(used on every non-fallthrough-root element) emits a standalonestyle="display: none;"chunk instead of merging v-show into the element's existing style. When the element already has a staticstyleattribute or a:stylebinding, the generated HTML contains TWOstyleattributes. The HTML parser keeps the FIRST, sodisplay:noneis dropped and v-show fails to hide the element (or, in the:stylecase, thedisplay:nonechunk renders first and the bound style is silently dropped). The sibling single-root path already merges correctly via_mergeProps, proving the element-level path is the buggy one.Reproduction
vue<template> <div class="wrapper"> <span style="color:red" v-show="ok">x</span> </div> </template>Actual
js<span style="color:red"${((_ctx.ok) ? "" : " style=\"display: none;\"")}> // when ok===false -> <span style="color:red" style="display: none;">x</span> ; browser keeps the first, display:none ignored<span v-show="ok" :style="{ color }">likewise emits two style attributes.Expected
Vue's SSR
ssrTransformShowrewrites v-show into the single style binding (style=[existing, expr ? null : {display:'none'}]) so there is exactly onestyleattribute.Suggested direction
In
process_v_show_on_element(plain.rs:479-493), inspect the element for an existing static attr or binding and merge into a single style binding, reusing the merge logic already present in the single-root path (, plain.rs:245-254). - Assistant
I'll start by inspecting the relevant SSR codegen files and reproducing the duplicate
styleattribute issue with v-show. - Assistant
I'll open the relevant sections of
plain.rsto compare the buggyprocess_v_show_on_elementpath with the correct merge logic. - Assistant
Let me look at process_v_show_on_element and more of the file.
- Assistant
I need to understand how styles and directives are processed on elements in this module.
- Assistant
Let me see process_element_attrs and how v-show is currently handled.
- Assistant
Let me also look at process_directive_on_element and how style bindings are handled, as well as normalize_prop_entries which merges styles.
- Assistant
There's already style merging when there's a dynamic bind for style at lines 378-388. Let me look at the full process_directive_on_element and process_v_bind.
- Assistant
I'll check existing tests and Vue's approach so we can match the expected SSR output.
- Assistant
Let me look at the v-show tests and snapshots.
- Assistant
Let me look at the existing snapshots for v-show and how the helper API works.
- Assistant
I'll look up Vue's expected SSR transform for v-show and related helpers.
- Assistant
No node_modules present — searching the repo and online references for Vue's SSR v-show transform.
- Assistant
I'll inspect how
get_compiled_stringwraps templates, since the v-show snapshots look nested. - Assistant
I'll check helpers and transforms for existing v-show utilities we can reuse.
- Assistant
I'll inspect commands available to build a quick repro and verify equivalent helpers.
- Assistant
I'll reproduce the bug with a small compile harness before changing the code.
- Assistant
I'll emit the buggy outputs via a one-off test binary next.
- Assistant
I'll run the reproduction from the repo so the workspace toolchain is applied.
- Assistant
Confirmed the duplicate
stylebug. Implementing the merge and removing the temporary debug test. - Assistant
I'll check how
cstr!and string helpers are used so the merge code matches existing style. - Assistant
The bang might have caused issues. Let me try again.
- Assistant
Implementing the merge logic in
process_element_attrsandprocess_v_show_on_element. - Assistant
Next I'll update
process_v_show_on_elementto emit one merged style binding. - Assistant
Let me open that section and replace it.
- Assistant
Now replace process_v_show_on_element.
- Assistant
I'll clean up the docstring typo and check that
ExpressionNode/merge_prop_valuesare available. - Assistant
The \m might have been escaped weirdly. Let me read the exact lines.
- Assistant
There's a literal
\merge. Let me fix it. - Assistant
Compiling and re-running the reproduction cases to verify the fix.
- Assistant
The merge looks correct. Restoring the test file and running the full SSR suite.
- Assistant
Checking whether library unit tests also ran:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.