From a3b70223302b1c3e660878352d46ab52a8c4b387 Mon Sep 17 00:00:00 2001 From: Paul Rangger Date: Sun, 27 Oct 2024 16:36:25 +0100 Subject: [PATCH 1/2] Avoid duplicate call --- .../conversation-messages/conversation-messages.component.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.ts b/src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.ts index 5a73e05471c2..b3ee2fcbfc98 100644 --- a/src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.ts +++ b/src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.ts @@ -107,6 +107,9 @@ export class ConversationMessagesComponent implements OnInit, AfterViewInit, OnD private subscribeToActiveConversation() { this.metisConversationService.activeConversation$.pipe(takeUntil(this.ngUnsubscribe)).subscribe((conversation: ConversationDTO) => { + if (this._activeConversation?.id === conversation.id) { + return; + } this._activeConversation = conversation; this.onActiveConversationChange(); }); From 1d2c3f5b1326f2293f1a72293c2786730089ad42 Mon Sep 17 00:00:00 2001 From: Paul Rangger Date: Sun, 27 Oct 2024 21:20:28 +0100 Subject: [PATCH 2/2] Added a comment for clarity --- .../conversation-messages/conversation-messages.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.ts b/src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.ts index b3ee2fcbfc98..5395a5a9eee3 100644 --- a/src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.ts +++ b/src/main/webapp/app/overview/course-conversations/layout/conversation-messages/conversation-messages.component.ts @@ -107,6 +107,7 @@ export class ConversationMessagesComponent implements OnInit, AfterViewInit, OnD private subscribeToActiveConversation() { this.metisConversationService.activeConversation$.pipe(takeUntil(this.ngUnsubscribe)).subscribe((conversation: ConversationDTO) => { + // This statement avoids a bug that reloads the messages when the conversation is already displayed if (this._activeConversation?.id === conversation.id) { return; }