Reduce render allocations and redundant work in core components
This commit is contained in:
@@ -195,7 +195,6 @@ impl RenderOnce for Sidebar {
|
||||
.clone()
|
||||
.unwrap_or_else(|| SharedString::from(self.id.to_string()));
|
||||
|
||||
let id_text = self.id.to_string();
|
||||
let scroll_area_id = (self.id.clone(), "entries");
|
||||
|
||||
// Entry paint reads the theme through this borrow.
|
||||
@@ -216,9 +215,10 @@ impl RenderOnce for Sidebar {
|
||||
})
|
||||
.collect();
|
||||
|
||||
let id = self.id;
|
||||
div()
|
||||
.id(self.id)
|
||||
.debug_selector(move || format!("sidebar-{id_text}"))
|
||||
.id(id.clone())
|
||||
.debug_selector(move || format!("sidebar-{id}"))
|
||||
.size_full()
|
||||
.flex()
|
||||
.flex_col()
|
||||
|
||||
@@ -307,8 +307,9 @@ fn render_tab(
|
||||
let mut strip_tab = div()
|
||||
.id((tab.key.clone(), "tab"))
|
||||
.debug_selector({
|
||||
let id = format!("{tabs_id}-tab-{}", tab.label);
|
||||
move || id
|
||||
let tabs_id = tabs_id.clone();
|
||||
let label = tab.label.clone();
|
||||
move || format!("{tabs_id}-tab-{}", label)
|
||||
})
|
||||
.flex()
|
||||
.items_center()
|
||||
@@ -411,8 +412,9 @@ fn render_tab_close(
|
||||
.small()
|
||||
.tab_stop(false)
|
||||
.debug_selector({
|
||||
let id = format!("{tabs_id}-close-{}", tab.label);
|
||||
move || id.clone()
|
||||
let tabs_id = tabs_id.clone();
|
||||
let label = tab.label.clone();
|
||||
move || format!("{tabs_id}-close-{}", label)
|
||||
})
|
||||
.tooltip(Tooltip::text("Close"))
|
||||
.accessibility_label(SharedString::from(format!("Close {}", tab.label)))
|
||||
|
||||
Reference in New Issue
Block a user