Skip to content

Conversation

@sehnryr
Copy link
Contributor

@sehnryr sehnryr commented Feb 8, 2025

When attributes are merged in Element::merge_attributes, out's source is not updated (I don't know if it should) and even if the segments are trivial, since source is empty we cannot consider it as a "simple expression" by is_simple_expr.

This would result in an issue when merging the following classes with me output being empty:

div {
    class: "foo",
    class: "{bar}",
}

I also modified the merges_attributes test splitting it into different cases:

  • merge_trivial_attributes: merge between two literals
  • merge_formatted_attributes: merge between a literal and a formatted
  • merge_conditional_attributes: merge between a literal and two conditionals
  • merge_all_attributes: merge between all of the above

@sehnryr sehnryr requested a review from a team as a code owner February 8, 2025 23:24
@sehnryr sehnryr force-pushed the fix/merge-formatted-attributes branch from 7d3bc10 to 703d46f Compare February 8, 2025 23:29
@jkelleyrtp jkelleyrtp merged commit fd65c12 into DioxusLabs:main Apr 15, 2025
17 checks passed
AnteDeliria pushed a commit to AnteDeliria/dioxus that referenced this pull request Jun 2, 2025
* test(rsx): add better tests for attributes merging

* fix(rsx): zero-lengthed source with non-empty segments is non-trivial

* refactor(rsx): use `is_empty` instead of `len() == 0` (clippy)

* fix(rsx): different asserts whether in release or not
AnteDeliria pushed a commit to AnteDeliria/dioxus that referenced this pull request Jul 23, 2025
* test(rsx): add better tests for attributes merging

* fix(rsx): zero-lengthed source with non-empty segments is non-trivial

* refactor(rsx): use `is_empty` instead of `len() == 0` (clippy)

* fix(rsx): different asserts whether in release or not
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants