Skip to content

fix(web): the terminal button reopens the drawer after its last terminal closed - #26

Closed
viktorce wants to merge 3 commits into
mainfrom
fix/terminal-reopen-two-clicks
Closed

viktorce wants to merge 3 commits into
mainfrom
fix/terminal-reopen-two-clicks

Conversation

@viktorce

@viktorce viktorce commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Fixes #22.

After you close the last terminal in a thread, the next click on the terminal button opened the drawer and closed it again about 20 ms later. A second click worked.

The terminal store remembers which terminal ids the server last listed (serverObservationsByThreadKey), and closes a local terminal that later drops off that list, so a terminal closed by another client leaves the drawer. A terminal you closed yourself stayed on the list, because the drawer unmounts before it sees the server drop the id. Reopening the drawer creates the same id (term-1), and the first reconcile treated it as closed elsewhere.

Now, when the client places a terminal id it doesn't already have, that id leaves the list. Whatever put it there, that listing is older than the new terminal, so it is about an earlier one. The next reconcile lists the id again if the server has it, so a terminal another client closes later still leaves the drawer. This one rule covers the drawer unmounting right after the close, the drawer seeing the closing terminal once more during its close animation, and an entry saved before this fix.

Proof

vp run scenarios:prove with an uncommitted scenario (open a terminal, close it with the trash icon, click the terminal button once): fails on base e37e45fd5b, passes on d8a42e0451 (the later commit only rewords a comment).

Before (e37e45fd5b): the first click on the terminal button does nothing, the second opens the drawer.

terminal-reopen-before.mp4

After (the fix): the first click opens the drawer.

terminal-reopen-after.mp4

The store test gets two rows, one per drawer timing. Both fail without the new rule.

Web and desktop share this code. Mobile has no copy of this logic.

Implemented by Claude Opus 5.5 in Claude Code (T3 Code), reviewed by Claude Fable 5.2 and GPT-6.1 Sol.

🤖 Generated with Claude Code

…nal closed

The terminal store remembers which terminal ids the server last listed, and
closes a local terminal that later drops off that list. A terminal the user
closed stayed on it, because the drawer unmounts before it sees the server
drop the id. Reopening the drawer creates the same id, and the first
reconcile closed it again.

A closed id now leaves the list when it closes, and stays off it while it is
still closing.
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M labels Nov 19, 2026
The store forgot a closed id at close time and kept it out of later
reconciles. An id saved by an older build never went through either path,
so its first reopen still took two clicks. Placing a fresh local id now
drops it from the observed list instead, which covers the close, the close
animation and the saved entry with one rule.
@viktorce

Copy link
Copy Markdown
Owner Author

Moved upstream as pingdotgg#39260, from this same branch.

@viktorce viktorce closed this Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terminal button needs two clicks after the terminal was closed

1 participant