Skip to content
TheChatArchiveThe Chat Archive
GLMz-ai/glm-5.2· unknownHugging 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. GLM Assistant

    I'll start by exploring the repository structure and understanding the codebase, then look at the specific file mentioned in the issue.

  3. GLM Assistant

    Let me look at the relevant file mentioned in the issue.

  4. GLM Assistant

    Now I understand the structure. Let me look at the relevant functions more closely. Let me first understand how process_v_bind_on_element handles the style case (lines 419-435) since that's the pattern I need to follow, and the helper functions used.

  5. GLM Assistant

    I need to make single tool calls. Let me search for the helper functions and understand the structure.

  6. GLM Assistant

    Let me look at the process_v_bind_on_element for style more closely and how the merge logic works. Let me also look at the helpers and check existing tests for v-show.

  7. GLM Assistant

    Let me look at the snapshot for this test and understand the expected output format.

  8. GLM Assistant

    Now I can see the component merge path (single-root) which uses _mergeProps with style: ["color: red;", ((_ctx.ok) ? null : { display: "none" })]. Let me look at the SSR snapshot test file and the v-show fixtures to understand more.

  9. GLM Assistant

    Let me look at how normalize_prop_entries and component_prop_entry work, since the single-root path relies on them to merge duplicate style keys.

  10. GLM Assistant

    Let me look at the v-show test fixtures and expected snapshots to understand desired behavior.

  11. GLM Assistant

    Let me reproduce the bug. First, let me check how to run the existing SSR tests and write a reproduction.

  12. GLM Assistant

    Now let me create a temporary reproduction test to confirm the bug:

  13. GLM Assistant

    The dependencies are being downloaded. Let me wait for the build to complete.

  14. GLM Assistant

    I've confirmed the bug — all three cases produce 2 style= attributes. Now let me check what helpers are available for detecting v-show in the codegen path.

  15. GLM Assistant

    Let me look at the _ssrRenderStyle runtime helper to ensure it handles arrays with null entries correctly.

  16. GLM Assistant

    Let me look at the v_bind_style snapshot to confirm _ssrRenderStyle handles arrays.

  17. GLM Assistant

    I've confirmed the bug. Now let me implement the fix. First, let me view the exact current text of the three areas I need to modify.

  18. GLM Assistant

    Now let me make the edits. First, process_element_attrs — add has_v_show detection and skip the static style attribute when v-show will handle the merged style:

  19. GLM Assistant

    I need to navigate to the line first. Let me open the file at the relevant location.

  20. GLM Assistant

    Edit 1 done. Now Edit 2 — process_v_bind_on_element Some("style") branch: skip emission when v-show will handle the merged style. Let me navigate to that area.

  21. GLM Assistant

    Edit 2 done. Now Edit 3 — rewrite process_v_show_on_element to merge existing styles. Let me navigate to it.

  22. GLM Assistant

    Now let me rewrite process_v_show_on_element to merge existing styles into a single binding:

  23. GLM Assistant

    Now let me verify merge_prop_values is accessible and the file compiles. Let me check the imports and build.

  24. GLM Assistant

    merge_prop_values is pub(super) and imported via use super::props::*. Now let me run my reproduction tests to confirm the fix works.

  25. GLM Assistant

    All three cases now produce exactly one style= attribute, matching the Vue pattern style=[existing, expr ? null : {display:'none'}]. Let me test additional edge cases: ordering variations, the no-style standalone case, and v-show without an expression.

  26. GLM Assistant

    Excellent! All edge cases pass. Let me also test the root-level (single-root / inherit_attrs) path and the v-show-without-expression edge case to ensure no regressions.

  27. GLM Assistant

    Let me see the failure details for the root-level cases.

  28. GLM Assistant

    The root-level failures are just my test assertions being wrong — the root (single-root/inherit_attrs) path uses _mergeProps({ style: [...] }, _attrs) which renders style at runtime via _ssrRenderAttrs, so there's no literal style= (count 0, which is correct). This path already worked correctly per the issue. Let me fix my temp test assertions to verify the right thing.

  29. GLM Assistant

    All 13 tests pass. Now let me remove the temporary test file and run the existing SSR test suite to ensure no regressions.

  30. GLM Assistant

    All 68 existing SSR tests pass. Let me run clippy to ensure no lint warnings (the crate enables clippy::all).

  31. GLM Assistant

    Clippy passes with no warnings. Let me check whether there are broader integration tests (in tests/) that exercise SSR v-show + style that might be affected.

  32. GLM Assistant

    No SSR fixtures exist in tests/ (only vdom/vapor). The SSR-specific tests are all in crates/vize_atelier_ssr/tests/ and pass. Let me do a final review of the complete diff.

  33. GLM Assistant

    The diff is clean and correct. Let me verify no temporary files remain and run the full SSR test suite one final time to confirm everything is green.

  34. GLM Assistant

    Everything is clean and complete. Let me provide a final summary of the checklist before submitting.

    Checklist

    • [x] Reproduced the error: I created a temporary test that confirmed the duplicate style= attribute (2 occurrences) for <span style="color:red" v-show="ok">, <span v-show="ok" :style="{ color }">, and the both-styles case. The output was <span style="color:red"${((_ctx.ok) ? "" : " style=\"display: none;\"")}> — exactly the bug described.

    • [x] Confirmed the fix resolves the error: After the fix, all three cases emit exactly one style attribute via _ssrRenderStyle(["color:red", ((_ctx.ok) ? null : { display: "none" })]) — matching Vue's ssrTransformShow pattern style=[existing, expr ? null : {display:'none'}]. _ssrRenderStyle ignores null when shown (existing style preserved) and renders display:none when hidden, so hiding now works.

    • [x] Considered edge cases: Tested ordering variations (style before/after v-show — both produce identical correct output), static-only, dynamic-only, both, no-style standalone (preserved exactly as before), other attrs like id preserved, comparison expressions (count > 0), class still merged correctly alongside style, nested v-show (one style per element, no duplicates), and the root/single-root inherit_attrs path (unchanged — already correct via _mergeProps). The skip logic is gated on get_v_show_exp(el).is_some() (not just has_v_show) so a hypothetical v-show-without-expression doesn't drop an existing :style/static style.

    • [x] Ran existing affected tests: All 68 vize_atelier_ssr tests pass (including v_show::basic_v_show and v_show::v_show_with_other_attrs snapshots, which are unchanged since the no-existing-style standalone path is preserved), and cargo clippy is clean.

    The fix has three coordinated parts in crates/vize_atelier_ssr/src/codegen/element/plain.rs:

    1. process_element_attrs — skip the static style attribute when v-show is present.
    2. process_v_bind_on_element (:style branch) — return early when v-show owns the merged style.
    3. process_v_show_on_element — inspect for existing static style/:style, and when present emit a single merged style="${_ssrRenderStyle([existing..., (expr ? null : {display:"none"})])}" binding; otherwise preserve the standalone conditional behavior.

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