feat(console/list-pages): persist selected item id in URL#18
Merged
Conversation
The list pages (Agent Turns, LLM Calls, HTTP Exchanges) all kept the slide-over detail's open id in React state, so copying the URL or hitting refresh dropped the selection and reopened the list with no panel — invisible to anyone trying to bookmark or share a link to a specific item. Other filters on these pages already round-trip through the URL via useSearchParamState; the selection was the one holdout. Move the selected id onto a `?selected=<id>` query param backed by the same hook. Effects: * Open detail → URL gains ?selected=<id>; copy / share lands a recipient on the same row with the panel open. * Refresh / back-forward navigation restores the panel. * Close panel → param removed (empty string is the default → hook drops it from the URL). LLM Calls and HTTP Exchanges also tracked `selectedIndex` for the prev/next buttons on their detail panels. The index is now derived from `items.findIndex(i => i.id === selectedId)` — one source of truth (the URL) and prev/next continues to work as long as the selected id is on the current page. If a paste-in id is no longer on the visible page, the buttons disable naturally (index = -1) but the detail still loads, since the panel queries by id rather than indexing into items. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 tasks
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.
Summary
Agent Turns, LLM Calls, and HTTP Exchanges keep the slide-over detail's open id in React state, so copying the URL or hitting refresh drops the selection and reopens the list with no panel. Every other filter on those pages already round-trips through the URL via `useSearchParamState`; this is the one holdout.
Move the selected id onto a `?selected=` query param backed by the same hook. Now:
Implementation detail
LLM Calls and HTTP Exchanges also tracked `selectedIndex` (for the panel's prev/next buttons). That state was redundant — the index is now derived from `items.findIndex(i => i.id === selectedId)`. One source of truth (the URL); prev/next still works as long as the selected id is on the current page.
If the URL points to an id that isn't on the visible page (e.g. someone pasted a link with a different filter or stale time range), the prev/next buttons naturally disable (`index = -1`) but the detail still loads — the panel queries by id rather than indexing into the list.
Verification
Test plan
🤖 Generated with Claude Code