Merge pull request #18795

This commit is contained in:
autocraft-bot[bot] committed 2026-12-02 01:07:07 +00:00
commit 234688b335
1 file changed
+17 -1
+17 -1
View File
@@ -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() {