~emersion/public-inbox

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

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

 1 files changed, 3 insertions(+), 1 deletions(-)
#755741 .build.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/public-inbox/patches/32170/mbox | git am -3
Learn more about email & git

[PATCH gamja] components/app: switch to server buffer on close only if active Export this patch

From: Umar Getagazov <umar@handlerug.me>

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
gamja/patches/.build.yml: SUCCESS in 51s

[components/app: switch to server buffer on close only if active][0] from [~handlerug][1]

[0]: https://lists.sr.ht/~emersion/public-inbox/patches/32170
[1]: mailto:umar@handlerug.me

✓ #755741 SUCCESS gamja/patches/.build.yml https://builds.sr.ht/~emersion/job/755741
In theory there's a race: this.state can be updated after we check it
but before this.setState(). But oh well, this.switchBuffer() already
suffers from the same issue already.

Pushed, thanks!