Skip to content
TheChatArchiveThe Chat Archive
MiniMaxminimax/minimax-m3· 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. MiniMax Assistant

    Let me start by exploring the repository structure to understand the codebase.

  3. MiniMax Assistant

    Let me look at more context around process_v_bind_on_element and process_element_attrs:

  4. MiniMax Assistant

    Now let me check the existing tests and how the SSR transformation is done:

  5. MiniMax Assistant

    Let me look at the codegen context to understand the state management:

  6. MiniMax Assistant

    Let me see how the codegen context helpers work:

  7. MiniMax Assistant

    Now let me look at how the snapshots are generated and how get_compiled_string works:

  8. MiniMax Assistant

    Let me check the existing imports and types:

  9. MiniMax Assistant

    Let me first write a script to reproduce the issue:

  10. MiniMax Assistant

    Let me create a test script to reproduce the issue:

  11. MiniMax Assistant

    Let me check the snapshot file format and write a quick reproducer using the existing test infrastructure:

  12. MiniMax Assistant

    Let me write an example file inside the SSR crate to reproduce the issue:

  13. MiniMax Assistant

    Now I've confirmed the bug. Let me design the fix:

  14. MiniMax Assistant

    Now I'll implement the fix. Let me start by modifying the SsrCodegenContext:

  15. MiniMax Assistant

    Now I'll add the pending_v_show_style_merges field. Let me update the codegen context:

  16. MiniMax Assistant

    Let me use a different approach to modify the file:

  17. MiniMax Assistant

    Now let me modify plain.rs to implement the fix:

  18. MiniMax Assistant

    Now I'll modify the relevant functions in plain.rs:

  19. MiniMax Assistant

    Let me simplify the modifications with separate, cleaner Python scripts:

  20. MiniMax Assistant

    Now patch process_v_bind_on_element to skip :style when merge is pending:

  21. MiniMax Assistant

    Now patch process_v_show_on_element:

  22. MiniMax Assistant

    The escape pattern in the file uses \\ (literal \\ in the source). Let me fix my Python script.

  23. MiniMax Assistant

    Now let me build to check for syntax errors:

  24. MiniMax Assistant

    Let me verify the modifications by looking at the file:

  25. MiniMax Assistant

    Let me now build and test the fix:

  26. MiniMax Assistant

    The fix works. Let me also test the case where v-show is alone:

  27. MiniMax Assistant

    I notice an edge case bug: when v-show has no expression, my fix is dropping the static style attribute. Let me fix that:

  28. MiniMax Assistant

    Now let me run the existing tests to make sure nothing is broken:

  29. MiniMax Assistant

    All tests pass. Let me verify the existing snapshots are still correct:

  30. MiniMax Assistant

    Let me check the existing v-bind style test output too:

  31. MiniMax Assistant

    Now let me check that _el parameter convention doesn't cause issues, since I renamed it to be used. Let me also handle a potential issue with the helper function imports:

  32. MiniMax Assistant

    Let me also check there are no clippy issues:

  33. MiniMax Assistant

    Let me test additional edge cases:

  34. MiniMax Assistant

    Let me look at normalize_prop_entries to understand the ordering:

  35. MiniMax Assistant

    Let me run the tests one more time to confirm everything still works:

  36. MiniMax Assistant

    Let me view the final state of my changes to make sure everything is good:

  37. MiniMax Assistant

    Looking good. Let me also check the codegen.rs for the field:

  38. MiniMax Assistant

    Let me clean up the temporary example file before submitting:

  39. MiniMax Assistant

    Let me do a final verification by running the tests one more time:

  40. MiniMax Assistant

    All 68 snapshot tests pass. Let me also run the unit tests in the codegen module and the main test:

  41. MiniMax Assistant

    Let me view the final summary of my changes:

  42. MiniMax Assistant

    Let me do one final verification using the exact reproduction from the issue:

  43. MiniMax Assistant

    I found a bug in my fix! Let me fix it:

  44. MiniMax Assistant

    Excellent! Now both cases produce a single style attribute. Let me re-run all the edge cases:

  45. MiniMax Assistant

    Let me run all the existing tests one more time to ensure nothing else is broken:

  46. MiniMax Assistant

    All tests pass. Let me verify the existing snapshots haven't changed:

  47. MiniMax Assistant

    Let me clean up the example directory:

  48. MiniMax Assistant

    Let me run the tests one more time to ensure everything still works after the cleanup, and run clippy to make sure no warnings:

  49. MiniMax Assistant

    Let me view the final state of the fix:

  50. MiniMax Assistant

    Let me also test a few more edge cases to ensure full coverage:

  51. MiniMax Assistant

    All edge cases work correctly. Let me clean up:

  52. MiniMax Assistant

    All checks are complete. Let me do a final summary of the work:

    Checklist:

    1. Issue reproduced ✅: I created a reproduction example that confirmed the bug — <span style="color:red" v-show="ok">x</span> was emitting two style attributes.

    2. Issue fixed ✅: After my fix, the same input emits a single merged style="${_ssrRenderStyle([...])}" attribute.

    3. Edge cases considered ✅: I tested multiple scenarios:

      • v-show alone (no style) — legacy behavior preserved
      • v-show + static style — merged
      • v-show + :style binding — merged
      • v-show + both static and :style — merged
      • v-show without expression — static style preserved
      • v-show before :style (Issue B) — merged correctly
      • v-show after :style — merged correctly
      • Nested elements — each processed independently
      • Sibling elements with same pattern — each gets its own merged style
      • input with v-model + v-show + style — merged
      • textarea with style + v-show — merged
      • Custom component with style — unchanged (uses inherit_attrs path)
      • Sibling elements sharing structure — each processed independently
    4. Existing tests pass ✅: 40 unit tests + 68 snapshot tests all pass.

    Implementation summary:

    • Added pending_v_show_style_merges: FxHashSet<usize> to SsrCodegenContext (codegen.rs).
    • Modified process_element_attrs (plain.rs:104): pre-detects the v-show + style merge case, suppresses standalone static style emission, and cleans up the merge flag at end.
    • Modified process_v_bind_on_element's :style arm (plain.rs:419): suppresses standalone :style emission when a merge is pending.
    • Modified process_v_show_on_element (plain.rs:535): emits a single _ssrRenderStyle([parts]) chunk when merge is pending; falls back to the legacy standalone style="display: none;" chunk otherwise.
    • Added helper has_v_show_directive (plain.rs:162): checks for a v-show directive that has an expression (so v-show without an expression is left as a no-op and its static style is rendered unchanged).

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