BlueGit

ict rusty-teams

fix(chat): a sent image no longer blinks when the download replaces it

- gpui draws nothing for the first 200 ms of an image load, even with a loading element, so the swap from the local copy to the downloaded file left a blank frame
- The local copy now sits under the downloaded image and stays visible until it is drawn

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-19 · 12 days ago

Hash
7f3dde67e17cfc8830b58d85f7039d8f9240ee4c
Parent
a06699ba
1 file changed +10 −7
crates/app/src/views/attachments.rs +10 −7
@@ -164,17 +164,20 @@ fn image_view(
164 164 let (image, open_image) = (image.clone(), open_image.cloned());
165 165 let frame = frame
166 166 .cursor_pointer()
167 .when_some(sent_preview, |frame, sent| {
168 frame.child(
169 div()
170 .absolute()
171 .inset_0()
172 .child(local_image(sent, format!("{image_id}-sent").into())),
173 )
174 })
167 175 .child(
168 176 img(preview(entry.path.clone()))
169 .id(image_id.clone())
177 .id(image_id)
170 178 .size_full()
171 179 .rounded(px(IMAGE_RADIUS))
172 .object_fit(ObjectFit::Cover)
173 .when_some(sent_preview.cloned(), |remote, sent| {
174 remote.with_loading(move || {
175 local_image(&sent, image_id.clone()).into_any_element()
176 })
177 }),
180 .object_fit(ObjectFit::Cover),
178 181 )
179 182 .when(clip, |frame| frame.child(play_badge()))
180 183 .on_click({
@@ -164,17 +164,20 @@ fn image_view(
164 let (image, open_image) = (image.clone(), open_image.cloned());
164 let (image, open_image) = (image.clone(), open_image.cloned());
165 let frame = frame
165 let frame = frame
166 .cursor_pointer()
166 .cursor_pointer()
167 .when_some(sent_preview, |frame, sent| {
168 frame.child(
169 div()
170 .absolute()
171 .inset_0()
172 .child(local_image(sent, format!("{image_id}-sent").into())),
173 )
174 })
167 .child(
175 .child(
168 img(preview(entry.path.clone()))
176 img(preview(entry.path.clone()))
169 .id(image_id.clone())
177 .id(image_id)
170 .size_full()
178 .size_full()
171 .rounded(px(IMAGE_RADIUS))
179 .rounded(px(IMAGE_RADIUS))
172 .object_fit(ObjectFit::Cover)
180 .object_fit(ObjectFit::Cover),
173 .when_some(sent_preview.cloned(), |remote, sent| {
174 remote.with_loading(move || {
175 local_image(&sent, image_id.clone()).into_any_element()
176 })
177 }),
178 )
181 )
179 .when(clip, |frame| frame.child(play_badge()))
182 .when(clip, |frame| frame.child(play_badge()))
180 .on_click({
183 .on_click({