Refine unread message count logic to reset only for the selected server.

This commit is contained in:
akastijn 2026-07-19 17:59:19 +02:00
parent aca9bd45ab
commit a3cb1247af

View File

@ -86,7 +86,13 @@ export class ChatService implements OnDestroy {
public selectServer(server: string) { public selectServer(server: string) {
this._selectedServer.set(server); this._selectedServer.set(server);
this._servers.update((old) => old.map((s) => ({...s, unreadMessages: 0}))); this._servers.update((old) =>
old.map((chatServer) =>
chatServer.server === server
? {...chatServer, unreadMessages: 0}
: chatServer
)
);
} }
// single, deliberate escape hatch from the broken DOM/polyfill type overlap — // single, deliberate escape hatch from the broken DOM/polyfill type overlap —