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.
This commit is contained in:
Simon Ser 2024-04-25 19:32:10 +02:00
parent 0b7726819d
commit 3d03c0dbcf

View file

@ -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;