#1202: an asset's chosen export format stays when the document changes

This commit is contained in:
bflatastic
2026-10-24 09:43:07 +07:00
parent a8363f062b
commit 20ffb1f844
2 changed files with 13 additions and 3 deletions
+11
View File
@@ -106,6 +106,17 @@ fn the_assets_list_shows_a_slice_with_a_preview_name_and_export_format() {
let fmt = find(egui::accesskit::Role::ComboBox, "Format");
assert_eq!(fmt.value(), Some("WebP"));
assert_eq!(fmt.is_expanded(), Some(false));
// A format picked there stays after the document changes.
let at = centre(fmt);
click(&mut u, at);
let svg = tree(&mut u).into_iter().find(|n| n.label() == Some("SVG")).expect("SVG in the format menu");
click(&mut u, centre(&svg));
let revision = u.app.session.ds().unwrap().revision;
u.app.session.execute("node.set", &json!({"ids": [slice], "props": {"name": "Avatar"}})).unwrap();
u.app.session.execute("node.set", &json!({"ids": [f], "props": {"name": "Sign in"}})).unwrap();
assert_ne!(u.app.session.ds().unwrap().revision, revision);
let fmt = tree(&mut u).into_iter().find(|n| n.role() == Role::ComboBox && n.label() == Some("Format")).unwrap();
assert_eq!(fmt.value(), Some("SVG"));
}
/// A "Button" component whose nested "Heart" instance is its instance-swap property "Icon", a
+2 -3
View File
@@ -2241,8 +2241,8 @@ pub(crate) fn prop_row(app: &mut FigApp, ui: &mut Ui, p: &figcraft_engine::devin
}
}
/// The thumbnails and chosen export formats of the Inspect tab's assets, kept between frames and
/// dropped when the document changes.
/// The thumbnails and chosen export formats of the Inspect tab's assets, kept between frames: the
/// thumbnails until the document changes, the formats for the session.
#[derive(Clone, Default)]
struct AssetUi {
revision: u64,
@@ -2274,7 +2274,6 @@ fn inspect_assets(app: &mut FigApp, ui: &mut Ui, doc: &Document, assets: &[figcr
if state.revision != revision {
state.revision = revision;
state.thumbs.clear();
state.formats.clear();
}
let px = ASSET_THUMB * ui.ctx().pixels_per_point();
for a in assets {