Add clickable column sorting to the session list table - #8
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8d101de3a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ) : ( | ||
| <FlatList | ||
| data={visibleSessions} | ||
| data={sortedSessions} |
There was a problem hiding this comment.
Use the displayed sort order for Shift-click ranges
After sorting any List column into an order that differs from the fetch order, renderItem supplies indexes from sortedSessions, but toggleSelected still slices activeViewSessionOrder, which returns the unsorted visibleSessions for List view. Thus Shift-clicking two displayed rows selects a different set of sessions than the visible range; subsequent bulk archive or delete can act on unintended sessions.
Useful? React with 👍 / 👎.
| const sortedSessions = useMemo(() => { | ||
| const accessor = SORT_ACCESSOR[sort.column]; | ||
| const factor = sort.direction === "asc" ? 1 : -1; | ||
| return [...visibleSessions].sort((a, b) => { | ||
| const left = accessor(a); | ||
| const right = accessor(b); | ||
| if (left < right) return -factor; | ||
| if (left > right) return factor; | ||
| return 0; | ||
| }); | ||
| }, [visibleSessions, sort]); |
There was a problem hiding this comment.
Preserve FTS relevance ordering until users sort
When a search query is present, SessionStore.listSessions deliberately returns FTS results ordered by relevance (ORDER BY rank in packages/cli/src/core/store.server.ts:293-304), including title matches ahead of weaker body matches. This unconditional initial created descending sort replaces that ranking even before the user clicks a column, and the UI has no way to return to relevance order, so search results can put less relevant recent sessions ahead of stronger matches.
Useful? React with 👍 / 👎.
The List view's table (SESSION/STATUS/PROJECT/CREATED/ACTIVE/MSG/SIZE) had no way to reorder rows other than the server's fixed created_at DESC default. Column headers are now pressable: click to sort by that column, click again to flip direction, with an arrow indicator on the active column. Timeline view is unaffected — it groups by day rather than columns, so it keeps its own ordering. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Only the active sort column showed an icon, so the sort affordance wasn't discoverable before clicking something. Every sortable header now shows a muted neutral icon (⇅) by default, turning into a solid directional arrow once active. Direction glyphs now follow the common spreadsheet convention (ascending = ▼, descending = ▲), which was backwards before. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
8d101de to
d278972
Compare
Mixing the double-line ⇅ (neutral) with solid ▲/▼ triangles (active) made the icon visibly change style, not just direction, on click. Switched to one glyph family throughout (↕ neutral, ↓/↑ active) and added a gap between the column label and its icon, which previously sat flush against each other. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Summary
created_at DESCdefault.Test plan
tsc --noEmitclean.npm run build && npm run package:plugin, thenpaseo plugin reload sessionforgeagainst a real local daemon — reloaded cleanly, logs showPlugin readywith no errors.