From 2a6e009a7dc43591da4d99b6978581362200a27f Mon Sep 17 00:00:00 2001 From: dino Date: Wed, 17 Dec 2025 23:50:30 +0000 Subject: [PATCH] refactor: only update list state when ui_font_size changes --- crates/settings_ui/src/settings_ui.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/settings_ui/src/settings_ui.rs b/crates/settings_ui/src/settings_ui.rs index f1316de125485b1a69ea6ae22c2b3506cb289e51..652b54760ea5b36b3b70ea4986b5f105bd989535 100644 --- a/crates/settings_ui/src/settings_ui.rs +++ b/crates/settings_ui/src/settings_ui.rs @@ -26,6 +26,7 @@ use std::{ sync::{Arc, LazyLock, RwLock}, time::Duration, }; +use theme::ThemeSettings; use title_bar::platform_title_bar::PlatformTitleBar; use ui::{ Banner, ContextMenu, Divider, DropdownMenu, DropdownStyle, IconButtonShape, KeyBinding, @@ -1376,6 +1377,7 @@ impl SettingsWindow { }) .detach(); + let mut ui_font_size = ThemeSettings::get_global(cx).ui_font_size(cx); cx.observe_global_in::(window, move |this, window, cx| { this.fetch_files(window, cx); @@ -1385,7 +1387,12 @@ impl SettingsWindow { // instruct the `ListState` to re-measure the list items, as the // list item heights may have changed depending on the new font // size. - this.list_state.clone().measure_all(); + let new_ui_font_size = ThemeSettings::get_global(cx).ui_font_size(cx); + if new_ui_font_size != ui_font_size { + ui_font_size = new_ui_font_size; + this.list_state.clone().measure_all(); + } + cx.notify(); }) .detach();