The web client loses its active tab when the JOIN event arrives before the join request returns #193

Closed
opened 2026-10-27 02:59:44 +01:00 by clawbot · 1 comment
Collaborator

In web/src/app.jsx, joinChannel sends the JOIN, adds the channel's tab if it is not there yet, and then makes tab number tabsRef.current.length the active one. That is the new tab's index only when the tab list has not changed in the meantime. Since the server queues the user's own JOIN event to every client of the session, the sending web client included, that event can arrive and add the tab before the JOIN request returns. tabsRef.current.length is then one past the last tab. The same happens when the user joins a channel whose tab is already open.

The active tab then points at no tab. The view falls back to the Server tab, and sendMessage returns at if (!tab) return; after clearing the input line, so everything the user types is silently dropped until they click a tab. Found while fixing #185; read from the code on 76ef8ff.

Fix: after a join from the web client, make the channel's own tab active, found by its name in the tab list, whichever arrives first, the JOIN event or the request's response. Change nothing else in the web client.

Definition of done

  1. After /join #chan from the web client, the #chan tab is active and what the user types next is sent to #chan, whether the JOIN event or the request's response arrives first.
  2. Joining a channel whose tab is already open makes that tab active.
  3. The PR says how each item was checked, since the web client has no test setup.
  4. One reviewed PR against next.

Model: opus-5-5

In `web/src/app.jsx`, `joinChannel` sends the `JOIN`, adds the channel's tab if it is not there yet, and then makes tab number `tabsRef.current.length` the active one. That is the new tab's index only when the tab list has not changed in the meantime. Since the server queues the user's own `JOIN` event to every client of the session, the sending web client included, that event can arrive and add the tab before the `JOIN` request returns. `tabsRef.current.length` is then one past the last tab. The same happens when the user joins a channel whose tab is already open. The active tab then points at no tab. The view falls back to the Server tab, and `sendMessage` returns at `if (!tab) return;` after clearing the input line, so everything the user types is silently dropped until they click a tab. Found while fixing https://git.eeqj.de/sneak/neoirc/issues/185; read from the code on `76ef8ff`. Fix: after a join from the web client, make the channel's own tab active, found by its name in the tab list, whichever arrives first, the `JOIN` event or the request's response. Change nothing else in the web client. ## Definition of done 1. After `/join #chan` from the web client, the `#chan` tab is active and what the user types next is sent to `#chan`, whether the `JOIN` event or the request's response arrives first. 2. Joining a channel whose tab is already open makes that tab active. 3. The PR says how each item was checked, since the web client has no test setup. 4. One reviewed PR against `next`. Model: opus-5-5
Author
Collaborator

Fix is in #196, awaiting review.

Model: opus-5-5

Fix is in https://git.eeqj.de/sneak/neoirc/pulls/196, awaiting review. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/neoirc#193