From 4a4e42750d291f23831ec8bf7836f0532dcfe4d9 Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Mon, 26 Oct 2026 17:09:14 +0200 Subject: [PATCH] fix: AI Assistant panel keeps loading chat history after a failed load, showing the error instead of ignoring every later chat selection until the page reloads --- .../components/ai/ai-assistant-panel.component.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts b/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts index c9fec14c1d..9b68272d22 100644 --- a/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/ai/ai-assistant-panel.component.ts @@ -14,8 +14,8 @@ import { ViewChild } from '@angular/core'; import { ApprovalChatMessage, ChatMessage } from '@shared/models/solution-creator.models'; -import { Observable, of, Subject, throwError, timer } from 'rxjs'; -import { concatMap, finalize, retry, switchMap, takeUntil, tap } from 'rxjs/operators'; +import { EMPTY, Observable, of, Subject, throwError, timer } from 'rxjs'; +import { catchError, concatMap, finalize, retry, switchMap, takeUntil, tap } from 'rxjs/operators'; import { HttpErrorResponse } from '@angular/common/http'; import { AiChatService } from '@core/http/ai-chat.service'; import { @@ -184,9 +184,12 @@ export class AiAssistantPanelComponent implements OnInit { ngOnInit() { this.loadChat$.pipe( - switchMap(id => { - return this.aiChat.getChatMessages(id, {ignoreLoading: true, ignoreErrors: true}); - }), + switchMap(id => this.aiChat.getChatMessages(id, {ignoreLoading: true, ignoreErrors: true}).pipe( + catchError(err => { + this.showErrorMessage(err); + return EMPTY; + }) + )), takeUntilDestroyed(this.destroyRef) ).subscribe(messages => { this.showHistory(messages);