Skip to content

Commit 4f8ad95

Browse files
Composer shows auto-compose summary only if it succeeded
1 parent 9db927e commit 4f8ad95

File tree

1 file changed

+16
-2
lines changed
  • src/webviews/apps/plus/composer/components

1 file changed

+16
-2
lines changed

src/webviews/apps/plus/composer/components/app.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
ChooseRepositoryCommand,
1515
ClearAIOperationErrorCommand,
1616
CloseComposerCommand,
17+
DidGenerateCommitsNotification,
1718
DismissOnboardingCommand,
1819
FinishAndCommitCommand,
1920
GenerateCommitMessageCommand,
@@ -345,7 +346,8 @@ export class ComposerApp extends LitElement {
345346
@consume({ context: stateContext, subscribe: true })
346347
state!: State;
347348

348-
@consume({ context: ipcContext })
349+
@consume<HostIpc>({ context: ipcContext, subscribe: true })
350+
@state()
349351
private _ipc!: HostIpc;
350352

351353
// Internal history management
@@ -443,6 +445,19 @@ export class ComposerApp extends LitElement {
443445
}
444446
}
445447

448+
// TODO: Move this to the composer app host, along with a bunch of other IPC handling that should be at that level (reload, cancellations, etc.)
449+
override connectedCallback() {
450+
super.connectedCallback?.();
451+
452+
this._ipc.onReceiveMessage(msg => {
453+
switch (true) {
454+
case DidGenerateCommitsNotification.is(msg):
455+
this.compositionSummarySelected = true;
456+
break;
457+
}
458+
});
459+
}
460+
446461
override disconnectedCallback() {
447462
super.disconnectedCallback?.();
448463
this.commitsSortable?.destroy();
@@ -1358,7 +1373,6 @@ export class ComposerApp extends LitElement {
13581373
this.selectedCommitId = null;
13591374
this.selectedCommitIds = new Set();
13601375
this.selectedUnassignedSection = null;
1361-
this.compositionSummarySelected = true;
13621376

13631377
this.generateCommitsWithAI(e.detail?.customInstructions);
13641378
}

0 commit comments

Comments
 (0)