Web UI: optimistic pin + rename (Phase 2)#285
Merged
Conversation
Toolbar pin and the rename dialog waited for the RPC round-trip and the session/state echo before the UI updated. Make them optimistic: - Pin flips the star + toolbar button immediately, then reconciles on the (idempotent) session/state echo; rolls back the local flag if the RPC fails. - Rename applies the new title locally and closes the dialog at once, so it feels instant and doesn't depend on the echo (which can lag — see #272); rolls back the title if the RPC fails. Both surface failures via appendError and restore prior state. Move / delete / restart are unchanged (echo-driven) for now. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 2 — makes the two cleanest session-list actions feel instant instead of waiting on the round-trip +
session/stateecho.Change
handleRowAction): flips the star and the toolbar button immediately, then reconciles the authoritative value on the (idempotent)session/stateecho. Rolls back the local flag if the RPC fails.submitRename): applies the new title locally and closes the dialog at once, so it feels instant and doesn't depend on the echo — which can lag (see Web UI doesn't live-update a session's title after rename #272), so this also masks that symptom for web-initiated renames. Rolls back the title if the RPC fails.Both surface failures via
appendErrorand restore prior state on rollback. Move / delete / restart stay echo-driven for now (more edge cases — a later item).Compatibility
The
web_smokepin test (handleRowAction('pin', 's1')) makes the identicalsession.set_pinnedcall and ends in the same DOM/toolbar state, so it's unaffected. No test drives rename.How to observe
Pin/unpin a session → star + toolbar button flip instantly. Rename a session → title updates and the dialog closes immediately, even on a slow connection.
🤖 Generated with Claude Code