Authentication-Results: mail-b.sr.ht; dkim=none Received: from git.sr.ht (unknown [173.195.146.142]) by mail-b.sr.ht (Postfix) with ESMTPSA id 7473D11EEDD; Wed, 11 May 2022 08:34:30 +0000 (UTC) From: ~handlerug Date: Wed, 11 May 2022 15:27:51 +0700 Subject: [PATCH gamja] components/app: switch to server buffer on close only if active Message-ID: <165225807033.22380.12271602005617229185-0@git.sr.ht> X-Mailer: git.sr.ht Reply-to: ~handlerug To: ~emersion/public-inbox@lists.sr.ht Cc: umar@handlerug.me Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 From: Umar Getagazov If the buffer that's being closed is not the active one, there's no point in switching the user away to another buffer. --- components/app.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/app.js b/components/app.js index 3c1f2a6..5de8b76 100644 --- a/components/app.js +++ b/components/app.js @@ -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); -- 2.34.2