From 90e40105d267079b65e80c0fc67f4cb76cb50856 Mon Sep 17 00:00:00 2001 From: aiongg Date: Fri, 20 Nov 2026 09:49:00 +0000 Subject: [PATCH] stories: start and metadata stories bind their story value through ValueAt They copied the value out and wrote it back, so their binds named the copy by address. --- crates/ui-shell/src/shell/start/stories.rs | 9 +++------ crates/ui-widgets/src/table/metadata/stories.rs | 12 ++++-------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/crates/ui-shell/src/shell/start/stories.rs b/crates/ui-shell/src/shell/start/stories.rs index 1647c70c9..c4954debd 100644 --- a/crates/ui-shell/src/shell/start/stories.rs +++ b/crates/ui-shell/src/shell/start/stories.rs @@ -1,7 +1,6 @@ //! Stories of `StartScreen`. use super::{StartLink, StartScreen}; -use crate::contract::Bind; use crate::primitives::{FakeThumbSource, ThumbnailOptions, Thumbnails}; use crate::runtime::env::Label; use crate::shell::{RecentFile, RecentSort, RecentView, ScreenModeCommands, Template, ThumbKey}; @@ -95,9 +94,9 @@ fn screen( templates: &[Template], extras: Extras<'_>, ) -> StoryOutput { - let mut choice = data.value("choice", choice).clone(); + let (choice, choice_at) = data.value_at("choice", choice); let thumbnails = Thumbnails::::in_context(ui.ctx(), "start-stories", ThumbnailOptions::new()); - let mut start = StartScreen::new(Bind::bound(&mut choice.view), Bind::bound(&mut choice.sort), files) + let mut start = StartScreen::new(choice_at.bind(&mut choice.view), choice_at.bind(&mut choice.sort), files) .pinned(pinned) .templates(templates) .now(NOW) @@ -108,9 +107,7 @@ fn screen( if let Some(hint) = extras.drop_hint { start = start.drop_hint(Label::from(hint.to_owned())); } - let shown = start.show(ui).into(); - *data.value("choice", Choice::default()) = choice; - shown + start.show(ui).into() } #[story(StartScreen<'static>, covers = [], drive = Drive::Never)] diff --git a/crates/ui-widgets/src/table/metadata/stories.rs b/crates/ui-widgets/src/table/metadata/stories.rs index 85f092573..9d499f3d4 100644 --- a/crates/ui-widgets/src/table/metadata/stories.rs +++ b/crates/ui-widgets/src/table/metadata/stories.rs @@ -33,10 +33,8 @@ fn groups() -> Vec { #[story(MetadataTable<'static>, covers = [Default], drive = Drive::Never)] fn metadata_table(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { - let mut filter = data.value("filter", String::new()).clone(); - let out = MetadataTable::new("Metadata", &groups()).filter(Bind::bound(&mut filter)).show(ui); - *data.value("filter", String::new()) = filter; - out.into() + let (filter, filter_at) = data.value_at("filter", String::new()); + MetadataTable::new("Metadata", &groups()).filter(filter_at.bind(filter)).show(ui).into() } #[story(MetadataTable<'static>, covers = [], drive = Drive::Never)] @@ -51,8 +49,6 @@ fn metadata_table_chooser(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { #[story(MetadataTable<'static>, covers = [Empty], drive = Drive::Never)] fn metadata_table_no_match(ui: &mut Ui, data: &mut StoryData) -> StoryOutput { - let mut filter = data.value("filter", "zzz".to_owned()).clone(); - let out = MetadataTable::new("Metadata", &groups()).filter(Bind::bound(&mut filter)).show(ui); - *data.value("filter", String::new()) = filter; - out.into() + let (filter, filter_at) = data.value_at("filter", "zzz".to_owned()); + MetadataTable::new("Metadata", &groups()).filter(filter_at.bind(filter)).show(ui).into() }