perf(settings): coalesce refreshes and cache resize previews

This commit is contained in:
aria committed 2026-10-28 06:56:03 +09:00
1 parent 6671960d5e
commit 81b99709bb
16 files changed
+906 -74

No files matched your search

+7 -20
View File
@@ -4,7 +4,7 @@ use ferese_panel::layout::{Placement, Resolution};
use ferese_panel::{Availability, Group, Item, ItemId, ItemKind, Panel, Representation, Zone};
use ferese_theme::panel::{Sample, Spacing, frame};
use crate::{App, Element, Message, panel_controls, visuals};
use crate::{App, Element, Message, visuals};
const SAMPLE_AVAILABILITY: Availability = Availability {
tray: true,
@@ -104,25 +104,7 @@ impl App {
}
pub(super) fn preview_panel(&self) -> Result<Panel, String> {
let panels = match self.draft.item("panels") {
Some(panels) => panels.clone(),
None => {
let crate::store::Edit::Set(_, panels) = panel_controls::initialize(&self.draft)?
else {
unreachable!()
};
panels
}
};
serde_json::from_value::<Vec<Panel>>(panels)
.map_err(|error| error.to_string())?
.into_iter()
.next()
.map(|mut panel| {
panel.consolidate_clock_controls();
panel
})
.ok_or_else(|| "No panel configured.".into())
self.draft.preview_panel()
}
fn panel_preview_frame(&self, panel: Panel) -> Element<'_, Message> {
@@ -628,6 +610,7 @@ mod tests {
"/unused/preview-test.kdl".into(),
crate::store::Snapshot::parse(String::new()),
None,
None,
),
)
.0;
@@ -764,6 +747,7 @@ mod tests {
"/unused/preview-centering.kdl".into(),
crate::store::Snapshot::parse(String::new()),
None,
None,
),
)
.0;
@@ -873,6 +857,7 @@ mod tests {
"/unused/alignment.kdl".into(),
crate::store::Snapshot::parse(String::new()),
None,
None,
),
)
.0;
@@ -980,6 +965,7 @@ mod tests {
"/unused/hover.kdl".into(),
crate::store::Snapshot::parse(String::new()),
None,
None,
),
)
.0;
@@ -1083,6 +1069,7 @@ mod tests {
"/unused/preview-test.kdl".into(),
crate::store::Snapshot::parse("panel main { group-surface unknown; }".into()),
None,
None,
),
)
.0;