components/app: prevent multiple WHO channel commands in parallel

References: https://todo.sr.ht/~emersion/gamja/152
This commit is contained in:
Simon Ser 2023-04-19 12:56:12 +02:00
parent 535bdb2f52
commit 2d651ef901

View file

@ -1373,10 +1373,18 @@ export default class App extends Component {
async whoChannelBuffer(target, serverID) {
let client = this.clients.get(serverID);
await client.who(target, {
fields: ["flags", "hostname", "nick", "realname", "username", "account"],
});
// Prevent multiple WHO commands for the same channel in parallel
this.setBufferState({ name: target, server: serverID }, { hasInitialWho: true });
let hasInitialWho = false;
try {
await client.who(target, {
fields: ["flags", "hostname", "nick", "realname", "username", "account"],
});
hasInitialWho = true;
} finally {
this.setBufferState({ name: target, server: serverID }, { hasInitialWho });
}
}
open(target, serverID, password) {