|
@@ -2,6 +2,7 @@ use crate::Writer;
|
|
|
use dioxus_rsx::*;
|
|
|
use proc_macro2::Span;
|
|
|
use std::{
|
|
|
+ borrow::Borrow,
|
|
|
fmt::Result,
|
|
|
fmt::{self, Write},
|
|
|
};
|
|
@@ -67,7 +68,8 @@ impl Writer {
|
|
|
// check if we have a lot of attributes
|
|
|
let attr_len = self.is_short_attrs(attributes);
|
|
|
let is_short_attr_list = attr_len < 80;
|
|
|
- let is_small_children = self.is_short_children(children).is_some();
|
|
|
+ let children_len = self.is_short_children(children);
|
|
|
+ let is_small_children = children_len.is_some();
|
|
|
|
|
|
// if we have few attributes and a lot of children, place the attrs on top
|
|
|
if is_short_attr_list && !is_small_children {
|
|
@@ -85,7 +87,11 @@ impl Writer {
|
|
|
|
|
|
// if we have few children and few attributes, make it a one-liner
|
|
|
if is_short_attr_list && is_small_children {
|
|
|
- opt_level = ShortOptimization::Oneliner;
|
|
|
+ if children_len.unwrap() + attr_len + self.out.indent * 4 < 100 {
|
|
|
+ opt_level = ShortOptimization::Oneliner;
|
|
|
+ } else {
|
|
|
+ opt_level = ShortOptimization::PropsOnTop;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// If there's nothing at all, empty optimization
|