Replace global ProfileStore with per-view ProfileDirectory instances
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s

This commit is contained in:
2026-10-15 14:19:18 +07:00
parent 89836a0394
commit 05221b5af9
15 changed files with 358 additions and 91 deletions
+12 -2
View File
@@ -20,7 +20,7 @@ use gpui_component::{
use signed_git::{
CommitDiff, DiffHunk, DiffLine, DiffLineKind, DiffStatus, FileCommit, FileDiff, Repo,
};
use signed_state::RepoStore;
use signed_state::{ProfileDirectory, RepoStore};
use signed_ui::{placeholder, tree_row};
use utils::relative_time_secs;
@@ -305,6 +305,8 @@ pub struct CommitDiffView {
loading: bool,
error: Option<SharedString>,
pane: Entity<DiffPane>,
/// Profile for the repository owner in the tab title.
directory: Entity<ProfileDirectory>,
tasks: Vec<gpui::Task<Result<(), anyhow::Error>>>,
}
@@ -318,6 +320,13 @@ impl CommitDiffView {
cx: &mut Context<Self>,
) -> Self {
let pane = cx.new(DiffPane::new);
let directory = ProfileDirectory::new(cx);
if let Some(owner) = store.read(cx).announcement.as_ref().map(|a| a.owner) {
directory.update(cx, |directory, cx| {
directory.track([owner], cx);
});
}
// Defer until the window is ready, like the repository detail view.
cx.defer_in(window, |this, window, cx| {
@@ -339,6 +348,7 @@ impl CommitDiffView {
loading: true,
error: None,
pane,
directory,
tasks: Vec::new(),
}
}
@@ -475,7 +485,7 @@ impl BasePanel for CommitDiffView {
impl Panel for CommitDiffView {
fn title(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
let avatar = repo_tab_avatar(self.store.read(cx), cx);
let avatar = repo_tab_avatar(self.store.read(cx), &self.directory, cx);
let label = SharedString::from(format!("{}/{}", self.repo_name, self.commit.id));
tab_title(avatar, label)