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.

git_ui: Improve GitHub avatar display (#56755)

Danilo Leale80b7443ea62
diff --git a/crates/git_ui/src/commit_tooltip.rs b/crates/git_ui/src/commit_tooltip.rs
index c2b7f21fad2..1921de78874 100644
--- a/crates/git_ui/src/commit_tooltip.rs
+++ b/crates/git_ui/src/commit_tooltip.rs
@@ -96,6 +96,15 @@ impl<'a> CommitAvatar<'a> {
}
pub fn avatar(&'a self, window: &mut Window, cx: &mut App) -> Option<Avatar> {
+ // Bail early if the email isn't available yet. Without it,
+ // the GitHub provider skips the fast CDN path and falls back
+ // to an unauthenticated per-commit API call that is slow and
+ // rate-limited. Worse, a failed lookup gets permanently
+ // cached under the key (sha, host) — so even when the email
+ // arrives on a later render, the cached None shadows the
+ // fast path forever.
+ self.author_email.as_ref()?;
+
let remote = self
.remote
.filter(|remote| remote.host_supports_avatars())?;