From 28d4f2d8d3ba45098492726fe00ab1a6538197de Mon Sep 17 00:00:00 2001 From: David Mann Date: Tue, 1 Dec 2026 20:04:26 +0100 Subject: [PATCH] Store framework sections as remembered state, not a settings edit (#18794) A dialog that remembers its place writes its framework section on every frame of a move or resize. PrefSections::sync stored it with edit_prefs, which moves the settings revision every panel version holds, so the dock rebuilt all its panels each frame and the engine re-applied its preferences. No view reads the sections from the preferences, so they are now stored with PrefsStore::remember: saved, no settings revision. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/app/framework.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/app/framework.rs b/crates/ui-egui/src/app/framework.rs index 744e8358f8..ea8e63a486 100644 --- a/crates/ui-egui/src/app/framework.rs +++ b/crates/ui-egui/src/app/framework.rs @@ -831,8 +831,11 @@ impl PrefSections { .filter_map(|key| Some((key.clone(), serde_json::to_value(t.tables.get(key)?).ok()?))) .filter(|(key, value)| session.prefs().sections.get(key) != Some(value)) .collect(); + // Remembered, not a settings edit: no view reads the sections back from the preferences (the components + // read them here), so the panels keep their versions and the engine applies nothing. A dialog that + // remembers its place writes on every frame of a drag. if !changed.is_empty() { - session.edit_prefs(|p| p.sections.extend(changed)); + session.prefs.remember(|p| p.sections.extend(changed)); } for key in written { let rev = session.section_rev(&key); @@ -986,6 +989,19 @@ mod tests { assert_eq!(store.read("one"), None); } + /// A component's section write is saved, but is no settings edit: the panels' versions hold the settings revision, + /// so an edit would rebuild every panel on each frame a dialog that remembers its place is dragged. + #[test] + fn a_section_write_is_saved_without_a_settings_edit() { + let store = PrefSections::default(); + let mut session = Session::new(); + let (saved, settings) = (session.prefs.rev(), session.prefs.settings_rev()); + store.write("one", table(1)); + store.sync(&mut session); + assert_ne!(session.prefs.rev(), saved, "the write reaches the saved preferences"); + assert_eq!(session.prefs.settings_rev(), settings, "the panels keep their versions"); + } + /// Every theme PhotoCraft has a palette for names a framework built-in. #[test] fn every_palette_theme_is_a_builtin() {