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 2022-05-11 15:27:51 +07:00 committed by Simon Ser
parent 6b04cb1417
commit 576b9d51eb

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