diff --git a/src/app/mod.rs b/src/app/mod.rs index 8ef9843..63ac6b0 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -44,6 +44,8 @@ struct State { columns: usize, + key: usize, + error: Option, } @@ -51,9 +53,10 @@ impl State { fn new() -> (Self, Task) { ( Self { - columns: 3, - error: None, images: BTreeMap::new(), + columns: 3, + key: 0, + error: None, }, Task::done(Message::OpenPath(Some( env::args() @@ -107,7 +110,7 @@ impl State { .arg(path) .spawn() .map_err(|e| e.to_string()) - .err() + .err(); } Message::OpenPath(opt_path) => { @@ -117,6 +120,7 @@ impl State { }; if let Some(path) = opt_path { + self.key += 1; self.open_path(path); } } @@ -164,6 +168,7 @@ impl State { || Element::from(widget::space()), |handle| widget::image(handle).into(), )) + .key(self.key) .anticipate(2000) .on_show(|_size| Message::LoadImage(path.clone())) .on_hide(Message::UnloadImage(path.clone())),