Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

ui: Render fallback icon for avatars that failed to load (#43183)

Lukas Wirthe6e5ccbf10c8
diff --git a/crates/ui/src/components/avatar.rs b/crates/ui/src/components/avatar.rs
index 19f7c4660bc..551ab4e3edf 100644
--- a/crates/ui/src/components/avatar.rs
+++ b/crates/ui/src/components/avatar.rs
@@ -91,7 +91,12 @@ impl RenderOnce for Avatar {
self.image
.size(image_size)
.rounded_full()
- .bg(cx.theme().colors().ghost_element_background),
+ .bg(cx.theme().colors().ghost_element_background)
+ .with_fallback(|| {
+ Icon::new(IconName::Person)
+ .color(Color::Muted)
+ .into_any_element()
+ }),
)
.children(self.indicator.map(|indicator| div().child(indicator)))
}