rebuild the chat session list on the shared data primitives
the list drew its own border per row on top of nothing, so every boundary between two rows was a double hairline, and it emphasised two things per row where the design language allows one. DataRow/DataList settle both. loading and empty were the same grey sentence, which made a slow transcript read look like an account with no history; they are now LoadingBlock and EmptyBlock, and a failed read gets an ErrorBlock with the actual message instead of rendering as "no sessions". rename and delete swallowed their failures whole — useClient only raises a dialog for 401, 403 and 5xx, and the likely error here is a 404 from a transcript that vanished under you. both toast now, as does a deep link to a session that cannot be read, which used to open an empty pane and say nothing. the New Chat button was duck-teal filled with duck-yellow text: duck-teal is a bright cyan in dark mode and duck-yellow has no dark override, so the pair sat near 2:1 contrast in both themes. active-row highlight now comes from the route rather than the selection channel, so it is right on a deep link before any panel has published, and deleting the open session navigates out of it instead of leaving a dead route. deletes SessionBar and SessionContextMenu: the first was exported through two barrels and imported nowhere, the second was never imported at all and typed its session id as a number. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -62,7 +62,7 @@ export function useClaudeSessions(cwd?: string | null) {
|
||||
const { isAuthenticated } = useAuth();
|
||||
const q = cwdQuery(cwd);
|
||||
|
||||
const { data, isLoading, refetch } = useQuery<{ sessions: ClaudeSessionSummary[] }>({
|
||||
const { data, isLoading, error, refetch } = useQuery<{ sessions: ClaudeSessionSummary[] }>({
|
||||
queryKey: [SESSIONS_KEY, cwd ?? 'default'],
|
||||
enabled: isAuthenticated,
|
||||
queryFn: () => client.get<{ sessions: ClaudeSessionSummary[] }>(`/chat/sessions${q}`),
|
||||
@@ -93,5 +93,16 @@ export function useClaudeSessions(cwd?: string | null) {
|
||||
[client, q, invalidate],
|
||||
);
|
||||
|
||||
return { sessions: data?.sessions ?? [], isLoading, refetch, loadSession, deleteSession, renameSession, invalidate };
|
||||
return {
|
||||
sessions: data?.sessions ?? [],
|
||||
isLoading,
|
||||
// Surfaced so the list can distinguish "no sessions" from "the read failed" — they rendered
|
||||
// identically before, and the second one is the only one you can act on.
|
||||
error,
|
||||
refetch,
|
||||
loadSession,
|
||||
deleteSession,
|
||||
renameSession,
|
||||
invalidate,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user