Narrow down syncBufferUnread to new buffers

syncBufferUnread might override the previous unread value.

Closes: https://todo.sr.ht/~emersion/gamja/105
This commit is contained in:
Simon Ser 2021-09-21 18:41:14 +02:00
parent 1dd55367e9
commit 65674cb45d

View file

@ -281,12 +281,16 @@ export default class App extends Component {
createBuffer(serverID, name) {
let client = this.clients.get(serverID);
let id = null;
let isNew = false;
this.setState((state) => {
let updated;
[id, updated] = State.createBuffer(state, name, serverID, client);
isNew = !!updated;
return updated;
});
this.syncBufferUnread(serverID, name);
if (isNew) {
this.syncBufferUnread(serverID, name);
}
return id;
}