Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-sonnet-5· anthropicHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION fix(atelierssr): v-show on a non-root element with an existing style…

  1. 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_element unconditionally appends a standalone style="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 standalone style="display: none;" chunk instead of merging v-show into the element's existing style. When the element already has a static style attribute or a :style binding, the generated HTML contains TWO style attributes. The HTML parser keeps the FIRST, so display:none is dropped and v-show fails to hide the element (or, in the :style case, the display:none chunk 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

    <template>
      <div class="wrapper">
        <span style="color:red" v-show="ok">x</span>
      </div>
    </template>
    

    Actual

    <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 ssrTransformShow rewrites v-show into the single style binding (style=[existing, expr ? null : {display:'none'}]) so there is exactly one style attribute.

    Suggested direction

    In process_v_show_on_element (plain.rs:479-493), inspect the element for an existing static style attr or :style binding and merge (expr ? null : { display: 'none' }) into a single style binding, reusing the merge logic already present in the single-root path (collect_element_directive_attr, plain.rs:245-254).

    Interface

    No new interfaces are introduced.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /vize, current file: none) bash-$

  2. Claude Assistant

    Now let's view the exact current lines around process_element_attrs and process_v_bind_on_element and process_v_show_on_element for precise editing.

  3. Claude Assistant

    Now let's update process_v_bind_on_element's "style" branch and process_v_show_on_element, plus add helper functions.

  4. Claude Assistant

    Now update process_v_show_on_element and add helper functions get_v_show_exp / has_style_source.

  5. Claude Assistant

    Now add the two helper methods near has_dynamic_bind.

  6. Claude Assistant

    Good, returns String. Now let's build the crate to check for compile errors.

  7. Claude Assistant

    Compiles clean. Now let's write a quick reproduction script using the crate's test infra to verify output.

  8. Claude Assistant

    This confirms the fix works correctly for all cases, including order-independence. Now let's remove the example file and run the full test suite for the crate.

  9. Claude Assistant

    All 108 tests pass. Let's also run the full workspace test suite to make sure nothing else broke, and check clippy for the modified file.

  10. Claude Assistant

    Clean clippy output. Let's view the final diff to review.

  11. Claude Assistant

    This looks good. Now let's double check nothing else in the repo references process_v_show_on_element with the old _el naming expectations, and run the full workspace test suite briefly.

  12. Claude Assistant

    Whole workspace builds fine. Let's also check git status to make sure no stray files remain.

  13. Claude Assistant

    Good, only the intended file is modified, and the temporary example file was removed.

    Now let me go through the checklist:

  14. Claude Assistant

    All checklist items are satisfied:

    • Reproduced the error: I wrote a temporary example (repro_vshow.rs, since removed) using compile_ssr directly, confirming the original code produced two style attributes for <span style="color:red" v-show="ok"> (style="color:red" immediately followed by a second dynamic style="display: none;" chunk), matching the issue's "Actual" output exactly.

    • Confirmed the fix resolves it: After the fix, the same reproduction cases produce a single merged style attribute using _ssrRenderStyle([...]):

      • static style + v-show → style="${_ssrRenderStyle(["color:red", ((_ctx.ok) ? null : { display: "none" })])}"
      • :style binding + v-show → style="${_ssrRenderStyle([{ color: _ctx.color }, ((_ctx.ok) ? null : { display: "none" })])}"
    • Edge cases considered:

      • No style source at all → unchanged old inline behavior (verified via existing v_show::basic_v_show / v_show::v_show_with_other_attrs snapshot tests still passing, and my repro script).
      • Attribute/directive order independence — verified both "style before v-show" and "v-show before style" orderings produce identical, correctly-merged output (implementation checks presence, not order, via has_style_source/get_v_show_exp lookups scanning all props).
      • :style dynamic binding case handled distinctly from static style attr case, both merge correctly, and the combination is symmetric with the pre-existing correct single-root (inherit_attrs) _mergeProps path via collect_element_directive_attr, which was left untouched since it already worked.
      • Void elements / elements without children unaffected since the change is purely in attribute-string emission logic, not structural.
    • Ran existing tests: cargo test -p vize_atelier_ssr → 40 unit tests + 68 snapshot tests, all passing. cargo build --workspace succeeds. cargo clippy -p vize_atelier_ssr --all-targets is clean with no new warnings.

    The change is now finalized and verified. Submitting.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.