From 25e69a551ebc2a648233b139fcebb4986f9c9ba6 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 29 Nov 2021 11:44:45 +0100 Subject: [PATCH] Clear channel joined field when disconnected --- components/app.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/components/app.js b/components/app.js index 5025307..426ed92 100644 --- a/components/app.js +++ b/components/app.js @@ -581,11 +581,26 @@ export default class App extends Component { client.addEventListener("status", () => { this.setServerState(serverID, { status: client.status }); - if (client.status === Client.Status.REGISTERED) { + switch (client.status) { + case Client.Status.DISCONNECTED: + this.setServerState(serverID, { account: null }); + this.setState((state) => { + let buffers = new Map(state.buffers); + state.buffers.forEach((buf) => { + if (buf.server !== serverID) { + return; + } + buffers.set(buf.id, { ...buf, joined: false }); + }); + return { buffers }; + }); + break; + case Client.Status.REGISTERED: this.setState({ connectForm: false }); if (errorID) { this.dismissError(errorID); } + break; } });