Skip to content

Commit

Permalink
Fixes overview repo selection
Browse files Browse the repository at this point in the history
  • Loading branch information
d13 committed Jan 27, 2025
1 parent 5f4aaa8 commit 264d429
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/webviews/apps/plus/home/components/active-work.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class GlActiveWork extends SignalWatcher(LitElement) {
}

private onChange(_e: MouseEvent) {
void this._activeOverviewState.changeRepository();
this._activeOverviewState.changeRepository();
}
}

Expand Down
14 changes: 10 additions & 4 deletions src/webviews/apps/plus/home/components/overviewState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import type {
OverviewFilters,
} from '../../../../home/protocol';
import {
ChangeOverviewRepository,
ChangeOverviewRepositoryCommand,
DidChangeOverviewFilter,
DidChangeOverviewRepository,
DidChangeRepositories,
DidChangeRepositoryWip,
GetActiveOverview,
Expand Down Expand Up @@ -44,6 +45,9 @@ export class ActiveOverviewState extends AsyncComputedState<ActiveOverview> {
case DidChangeRepositoryWip.is(msg):
this.run(true);
break;
case DidChangeOverviewRepository.is(msg):
this.run(true);
break;
}
});
}
Expand All @@ -52,9 +56,8 @@ export class ActiveOverviewState extends AsyncComputedState<ActiveOverview> {
this._disposable?.dispose();
}

async changeRepository(): Promise<void> {
await this._ipc.sendRequest(ChangeOverviewRepository, undefined);
this.run(true);
changeRepository(): void {
this._ipc.sendCommand(ChangeOverviewRepositoryCommand, undefined);
}
}

Expand Down Expand Up @@ -84,6 +87,9 @@ export class InactiveOverviewState extends AsyncComputedState<InactiveOverview>
this.filter.stale = msg.params.filter.stale;
this.run(true);
break;
case DidChangeOverviewRepository.is(msg):
this.run(true);
break;
}
});
void this._ipc.sendRequest(GetOverviewFilterState, undefined).then(rsp => {
Expand Down
11 changes: 6 additions & 5 deletions src/webviews/home/homeWebview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,13 @@ import type {
State,
} from './protocol';
import {
ChangeOverviewRepository,
ChangeOverviewRepositoryCommand,
CollapseSectionCommand,
DidChangeIntegrationsConnections,
DidChangeLaunchpad,
DidChangeOrgSettings,
DidChangeOverviewFilter,
DidChangeOverviewRepository,
DidChangePreviewEnabled,
DidChangeRepositories,
DidChangeRepositoryWip,
Expand Down Expand Up @@ -235,7 +236,7 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe

if (pick == null || pick === currentRepo) return;

this.selectRepository(pick.path);
return this.selectRepository(pick.path);
}

private onRepositoriesChanged() {
Expand Down Expand Up @@ -353,9 +354,9 @@ export class HomeWebviewProvider implements WebviewProvider<State, State, HomeWe
case GetOverviewFilterState.is(e):
void this.host.respond(GetOverviewFilterState, e, this._overviewBranchFilter);
break;
case ChangeOverviewRepository.is(e):
await this.onChooseRepository();
void this.host.respond(ChangeOverviewRepository, e, undefined);
case ChangeOverviewRepositoryCommand.is(e):
if ((await this.onChooseRepository()) == null) return;
void this.host.notify(DidChangeOverviewRepository, undefined);
break;
case TogglePreviewEnabledCommand.is(e):
this.onTogglePreviewEnabled();
Expand Down
7 changes: 2 additions & 5 deletions src/webviews/home/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ export const GetLaunchpadSummary = new IpcRequest<GetLaunchpadSummaryRequest, Ge
'launchpad/summary',
);

export interface GetOverviewRequest {
[key: string]: unknown;
}

export interface GetOverviewBranch {
reference: GitBranchReference;

Expand Down Expand Up @@ -238,7 +234,8 @@ export const GetInactiveOverview = new IpcRequest<GetInactiveOverviewRequest, Ge
export type GetOverviewFilterStateResponse = OverviewFilters;
export const GetOverviewFilterState = new IpcRequest<void, GetOverviewFilterStateResponse>(scope, 'overviewFilter');

export const ChangeOverviewRepository = new IpcRequest<undefined, undefined>(scope, 'overview/repository/change');
export const ChangeOverviewRepositoryCommand = new IpcCommand<undefined>(scope, 'overview/repository/change');
export const DidChangeOverviewRepository = new IpcNotification<undefined>(scope, 'overview/repository/didChange');

// COMMANDS

Expand Down

0 comments on commit 264d429

Please sign in to comment.