components/app: switch to server buffer on close only if active

If the buffer that's being closed is not the active one, there's no
point in switching the user away to another buffer.
This commit is contained in:
Umar Getagazov authored and Simon Ser committed 2022-06-08 15:05:26 +02:00
1 parent 6b04cb1417
commit 576b9d51eb
1 file changed
+3 -1
+3 -1
View File
@@ -1298,7 +1298,9 @@ export default class App extends Component {
}
// fallthrough
case BufferType.NICK:
this.switchBuffer({ name: SERVER_BUFFER });
if (this.state.activeBuffer === buf.id) {
this.switchBuffer({ name: SERVER_BUFFER });
}
this.setState((state) => {
let buffers = new Map(state.buffers);
buffers.delete(buf.id);