From d9751fe2e6e612f0f402433a57f57881568016da Mon Sep 17 00:00:00 2001 From: electria Date: Sun, 9 Aug 2026 15:32:24 -0700 Subject: [PATCH] fix: flickering it does still reload the image, but at least it doesn't flicker while doing so this also exposes a problem with the error reporting, since with so many error-reporting operations going on, the errors that do happen are most often immediately cleared. --- src/app/mod.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/mod.rs b/src/app/mod.rs index b384ebd..eeae390 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -87,9 +87,13 @@ impl State { self.error = result.as_ref().err().map(|e| e.to_string()); if let Ok((path, handle)) = result { - self.images - .entry(path) - .and_modify(|e| *e = MaybeImage::Loaded(handle)); + let entry = self.images.entry(path).or_default(); + + if matches!(entry, MaybeImage::Loaded(_)) { + self.error = Some("tried to load already-loaded image!".into()) + } else { + *entry = MaybeImage::Loaded(handle) + } } }