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

    Good, ExpressionNode and PropNode already available via super::*. Now let's implement the changes.

  3. Claude Assistant

    Now let's check the process_v_show_on_element function and RuntimeHelper import to ensure SsrRenderStyle is in scope, and build.

  4. Claude Assistant

    Builds fine. Now let's check process_v_show_on_element still works for the no-existing-style case, and check for unused _el param warning etc.

  5. Claude Assistant

    No warnings shown (grep found nothing, exit code 1 is just grep's "no match"). Now let's write a quick reproduction script using the crate's test infra to verify actual output.

  6. Claude Assistant

    Existing tests exist. Let's look at them.

  7. Claude Assistant

    These don't have style attrs, so should remain unchanged. Now let's write a temp reproduction test.

  8. Claude Assistant

    Now let's write a quick temp test file to check reproduction cases using cargo test as a script (without modifying existing test files).

  9. Claude Assistant

    This all works as expected. Now clean up the example file and run the existing test suite.

  10. Claude Assistant

    All existing tests pass. Let's also run the broader workspace tests related to SSR/vitrine to make sure nothing else depends on old behavior.

  11. Claude Assistant

    That's fine, only ssr crate relevant. Let's run full workspace build to be safe.

  12. Claude Assistant

    Full workspace builds. Now let's view the final diff for review.

  13. Claude Assistant

    That's fine, unrelated. Let's check clippy for warnings in our modified file.

  14. Claude Assistant

    Let's just build the joined array string manually to avoid .join type issues, using merge_prop_values-like style building.

  15. Claude Assistant

    Now let's rerun clippy to confirm no more disallowed-type/macro warnings.

  16. Claude Assistant

    No warnings. Now let's re-run the reproduction example and the full test suite again.

  17. Claude Assistant

    Same expected results, still correct after refactor. Clean up example file and rerun full test suite.

  18. Claude Assistant

    All 68 + 40 tests pass. Let's build workspace once more to be sure nothing else broke, and view final diff.

  19. Claude Assistant

    Both changes intact, workspace builds successfully. Let's view the final diff for a full review.

  20. Claude Assistant

    Good, consistent CompactString usage everywhere. Now let's also double check push_string_part_static("\"") etc — already used same pattern elsewhere. Let's run full test suite once more and remove leftover repro files.

  21. Claude Assistant

    Everything is clean. Now let's go through the checklist.

  22. Claude Assistant

    Checklist review:

    • Reproduced the reported error: Yes — I wrote a temporary example (repro_vshow.rs, removed before submitting) reproducing <span style="color:red" v-show="ok"> and <span :style="{...}" v-show="ok">, confirming the original code emitted two separate style="..." chunks (one static, one from process_v_show_on_element's unconditional " style=\"display: none;\"" string), which is exactly the duplicate-attribute bug described in the issue.

    • Confirmed the fix resolves the error: Yes — after the fix, the same reproduction cases now emit a single style="${_ssrRenderStyle([...])}" chunk that merges the existing static style and/or :style binding together with the v-show display:none toggle via _ssrRenderStyle, matching Vue's ssrTransformShow behavior and producing exactly one style attribute.

    • Thought about edge cases: Yes — handled: (1) v-show with no existing style at all (kept the original lightweight standalone-toggle behavior, verified via basic_v_show/v_show_with_other_attrs tests still passing), (2) v-show + static style only, (3) v-show + :style binding only, (4) v-show + both static style and :style binding simultaneously, (5) v-show directive appearing before vs. after the style attribute/binding in source order (merge point is resolved deterministically regardless of order), and (6) elements with class bindings unaffected (existing class-merge logic untouched).

    • Ran existing tests: Yes — cargo test -p vize_atelier_ssr (108 tests across unit + snapshot suites) all pass, and cargo build --workspace succeeds with no compile errors. Also ran cargo clippy -p vize_atelier_ssr --all-targets and fixed the disallowed-type/macro warnings it flagged (switched to project conventions: CompactString/cstr!/append! instead of std::String/format!), leaving zero warnings.

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