Skip to content

Commit e6f5a9a

Browse files
committed
Fixes avatars from getting lost on Home
1 parent 2e362df commit e6f5a9a

File tree

4 files changed

+4
-78
lines changed

4 files changed

+4
-78
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
1717
### Fixed
1818

1919
- Fixes [#3899](https://github.com/gitkraken/vscode-gitlens/issues/#3899) - custom autolinks not being detected
20+
- Fixes owner avatars from getting lost (progressively) on refresh of the _Home_ view
2021
- Fixes launchpad status icon for 'waiting for review' state on _Home_
2122
- Fixes missing _Delete Branch..._ command from branches on worktrees in the _Branches_ view
2223

src/webviews/apps/plus/home/components/branch-card.ts

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ export abstract class GlBranchCardBase extends GlElement {
243243
this.autolinksPromise = value?.autolinks;
244244
this.contributorsPromise = value?.contributors;
245245
this.issuesPromise = value?.issues;
246-
this.ownerPromise = value?.owner;
247246
this.prPromise = value?.pr;
248247
this.wipPromise = value?.wip;
249248
}
@@ -308,26 +307,6 @@ export abstract class GlBranchCardBase extends GlElement {
308307
);
309308
}
310309

311-
@state()
312-
private _owner!: Awaited<GetOverviewBranch['owner']>;
313-
get owner() {
314-
return this._owner;
315-
}
316-
317-
private _ownerPromise!: GetOverviewBranch['owner'];
318-
get ownerPromise() {
319-
return this._ownerPromise;
320-
}
321-
set ownerPromise(value: GetOverviewBranch['owner']) {
322-
if (this._ownerPromise === value) return;
323-
324-
this._ownerPromise = value;
325-
void this._ownerPromise?.then(
326-
r => (this._owner = r),
327-
() => (this._owner = undefined),
328-
);
329-
}
330-
331310
@state()
332311
private _pr!: Awaited<GetOverviewBranch['pr']>;
333312
get pr() {
@@ -526,24 +505,12 @@ export abstract class GlBranchCardBase extends GlElement {
526505
}
527506

528507
protected renderAvatars() {
529-
const { owner, contributors } = this;
530-
531-
const avatars = [];
532-
533-
if (owner) {
534-
avatars.push(owner);
535-
}
508+
const { contributors } = this;
536509

537-
if (contributors) {
538-
avatars.push(...contributors);
539-
}
540-
541-
if (avatars.length === 0) {
542-
return undefined;
543-
}
510+
if (!contributors?.length) return undefined;
544511

545512
return html`<gl-avatar-list
546-
.avatars=${avatars.map(a => ({ name: a.name, src: a.avatarUrl }))}
513+
.avatars=${contributors.map(a => ({ name: a.name, src: a.avatarUrl }))}
547514
max="1"
548515
></gl-avatar-list>`;
549516
}

src/webviews/home/homeWebview.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ type BranchMergeTargetStatusInfo = Awaited<GetOverviewBranch['mergeTarget']>;
119119
type ContributorsInfo = Awaited<GetOverviewBranch['contributors']>;
120120
type IssuesInfo = Awaited<GetOverviewBranch['issues']>;
121121
type LaunchpadItemInfo = Awaited<NonNullable<Awaited<GetOverviewBranch['pr']>>['launchpad']>;
122-
type OwnerInfo = Awaited<GetOverviewBranch['owner']>;
123122
type PullRequestInfo = Awaited<GetOverviewBranch['pr']>;
124123
type WipInfo = Awaited<GetOverviewBranch['wip']>;
125124

@@ -1323,7 +1322,6 @@ function enrichOverviewBranches(
13231322
branch.wip = getWipInfo(container, branch, statusPromises.get(branch.id), isActive);
13241323

13251324
const contributors = contributorsPromises.get(branch.id);
1326-
branch.owner = getOwnerInfo(container, contributors);
13271325
branch.contributors = getContributorsInfo(container, contributors);
13281326

13291327
branch.mergeTarget = mergeTargetPromises.get(branch.id);
@@ -1379,29 +1377,6 @@ async function getContributorsInfo(
13791377
return result.map(r => (r.status === 'fulfilled' ? r.value : undefined)).filter(r => r != null);
13801378
}
13811379

1382-
async function getOwnerInfo(
1383-
_container: Container,
1384-
contributorsPromise: Promise<BranchContributorOverview | undefined> | undefined,
1385-
) {
1386-
if (contributorsPromise == null) return undefined;
1387-
1388-
const contributors = await contributorsPromise;
1389-
if (contributors == null) return undefined;
1390-
1391-
const owner = contributors.owner ?? contributors.contributors?.shift();
1392-
if (owner == null) return undefined;
1393-
1394-
return {
1395-
name: owner.name ?? '',
1396-
email: owner.email ?? '',
1397-
current: owner.current,
1398-
timestamp: owner.date?.getTime(),
1399-
count: owner.count,
1400-
stats: owner.stats,
1401-
avatarUrl: (await owner.getAvatarUri())?.toString(),
1402-
} satisfies OwnerInfo;
1403-
}
1404-
14051380
async function getBranchMergeTargetStatusInfo(
14061381
container: Container,
14071382
branch: GitBranch,

src/webviews/home/protocol.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -108,23 +108,6 @@ export interface GetOverviewBranch {
108108
| undefined
109109
>;
110110

111-
owner?: Promise<
112-
| {
113-
name: string;
114-
email: string;
115-
avatarUrl: string;
116-
current: boolean;
117-
timestamp?: number;
118-
count: number;
119-
stats?: {
120-
files: number;
121-
additions: number;
122-
deletions: number;
123-
};
124-
}
125-
| undefined
126-
>;
127-
128111
contributors?: Promise<
129112
{
130113
name: string;

0 commit comments

Comments
 (0)