Skip to content

Commit 532e913

Browse files
0HyperCubeKeavon
andauthored
Fix DropdownInput widget not reactively updating when its content changes (#2770)
* Improve reactivity of DropdownInput.svelte * Fix formatting lint --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
1 parent 62c7f88 commit 532e913

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

frontend/src/components/widgets/inputs/DropdownInput.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
let open = false;
3131
3232
$: watchSelectedIndex(selectedIndex);
33+
$: watchEntries(entries);
3334
$: watchActiveEntry(activeEntry);
3435
$: watchOpen(open);
3536
@@ -38,7 +39,13 @@
3839
}
3940
4041
// Called only when `selectedIndex` is changed from outside this component
41-
function watchSelectedIndex(_?: number) {
42+
function watchSelectedIndex(_?: typeof selectedIndex) {
43+
activeEntrySkipWatcher = true;
44+
activeEntry = makeActiveEntry();
45+
}
46+
47+
// Called only when `entries` is changed from outside this component
48+
function watchEntries(_?: typeof entries) {
4249
activeEntrySkipWatcher = true;
4350
activeEntry = makeActiveEntry();
4451
}

node-graph/gcore/src/raster/image.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,15 @@ pub fn migrate_image_frame<'de, D: serde::Deserializer<'de>>(deserializer: D) ->
291291
*image_frame_table.instance_mut_iter().next().unwrap().alpha_blending = alpha_blending;
292292
image_frame_table
293293
}
294-
FormatVersions::ImageFrame(image_frame) => RasterDataTable::new(Raster::new_cpu(image_frame.instance_ref_iter().next().unwrap().instance.image.clone())),
294+
FormatVersions::ImageFrame(image_frame) => RasterDataTable::new(Raster::new_cpu(
295+
image_frame
296+
.instance_ref_iter()
297+
.next()
298+
.unwrap_or(Instances::new(ImageFrame::default()).instance_ref_iter().next().unwrap())
299+
.instance
300+
.image
301+
.clone(),
302+
)),
295303
FormatVersions::ImageFrameTable(image_frame_table) => RasterDataTable::new(Raster::new_cpu(image_frame_table.instance_ref_iter().next().unwrap().instance.clone())),
296304
FormatVersions::RasterDataTable(raster_data_table) => raster_data_table,
297305
})

0 commit comments

Comments
 (0)