From 3d03c0dbcfc204114ae68ac4083b30b1e0d99cdc Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 25 Apr 2024 19:32:10 +0200 Subject: [PATCH] components/app: update prevReadReceipt only when switching buffer We don't want the unread separator to move around when the tab gets focus, for instance. --- components/app.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/components/app.js b/components/app.js index 29039c5..581106e 100644 --- a/components/app.js +++ b/components/app.js @@ -539,7 +539,13 @@ export default class App extends Component { if (!buf) { return; } - return { activeBuffer: buf.id }; + + let client = this.clients.get(buf.server); + let stored = this.bufferStore.get({ name: buf.name, server: client.params }); + let prevReadReceipt = getReceipt(stored, ReceiptType.READ); + let update = State.updateBuffer(state, buf.id, { prevReadReceipt }); + + return { activeBuffer: buf.id, ...update }; }, () => { if (!buf) { return; @@ -572,14 +578,7 @@ export default class App extends Component { if (!buf) { return; } - - let client = this.clients.get(buf.server); - let stored = this.bufferStore.get({ name: buf.name, server: client.params }); - let prevReadReceipt = getReceipt(stored, ReceiptType.READ); - return State.updateBuffer(state, buf.id, { - unread: Unread.NONE, - prevReadReceipt, - }); + return State.updateBuffer(state, buf.id, { unread: Unread.NONE }); }, () => { if (!buf) { return;