Skip to content

Commit 3f890ce

Browse files
ergunshDevtools-frontend LUCI CQ
authored andcommitted
[AiAssistance] Fix changing panels breaking conversation when loading
I think, while doing refactoring, we updated the logic to save the initial message to history after receiving the response from AidaClient. This made `isEmpty` to return `false` when there is a loading request in flight. So, whenever the user changed the panel while a request is in flight; it changed the `#currentAgent`. This CL fixes it by adding `isLoading` check to the `#selectDefaultAgentIfNeeded` method. Fixed: 395886018 Change-Id: Iedc50c968eec7bec9faa72f9dba3c9af84b38e2d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6253022 Auto-Submit: Ergün Erdoğmuş <[email protected]> Reviewed-by: Alex Rudenko <[email protected]> Commit-Queue: Ergün Erdoğmuş <[email protected]> Commit-Queue: Alex Rudenko <[email protected]>
1 parent ad845bf commit 3f890ce

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

front_end/panels/ai_assistance/AiAssistancePanel.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,10 @@ export class AiAssistancePanel extends UI.Panel.Panel {
400400
// We select the default agent based on the open panels if
401401
// there isn't any active conversation.
402402
#selectDefaultAgentIfNeeded(): void {
403-
// If there already is an agent and not it is not empty,
404-
// we don't automatically change the agent.
405-
if (this.#currentAgent && !this.#currentAgent.isEmpty) {
403+
// If there already is an agent and if it is not empty,
404+
// we don't automatically change the agent. In addition to this,
405+
// we don't change the current agent when there is a message in flight.
406+
if ((this.#currentAgent && !this.#currentAgent.isEmpty) || this.#viewProps.isLoading) {
406407
return;
407408
}
408409

0 commit comments

Comments
 (0)