Repository navigation
feat(prompts): sortable columns on All Prompts (visibility / mentions / volume / last run) with URL deep-link - #322
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds client-side, URL-persisted sorting to the All Prompts table so users can deep-link/share a sorted view and quickly surface extremes by key metrics.
Changes:
- Introduces a
compareNullsLastcomparator helper (with Vitest coverage) to keep missing/unanalysed values sorted last in both directions. - Adds sortable table headers for Visibility / Mentions / Volume / Last run, including chevron indicators for the active sort.
- Hydrates and persists
sort/dirviauseSearchParams+router.replace(..., { scroll: false }), mirroring the existingtabURL sync.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| web/src/app/[locale]/(dashboard)/dashboard/prompts/prompt-sort.ts | Adds the nulls-last comparator used by All Prompts sorting. |
| web/src/app/[locale]/(dashboard)/dashboard/prompts/prompt-sort.test.ts | Adds unit tests validating ascending/descending behavior and nulls-last behavior. |
| web/src/app/[locale]/(dashboard)/dashboard/prompts/page.tsx | Wires URL-driven sort state into the All Prompts tab and replaces static headers with sortable ones. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+149
to
+155
| <TableHead className={className}> | ||
| <span className="inline-flex items-center gap-1"> | ||
| <button | ||
| type="button" | ||
| onClick={() => onSort(sortKey)} | ||
| aria-label={`Sort by ${typeof children === 'string' ? children : sortKey}`} | ||
| className={cn( |
Make the visibility / mentions / volume / last-run headers clickable to sort the All Prompts table. Click toggles desc<->asc (new column starts desc); the active column + direction show a chevron. The sort is written to the URL (?tab=all&sort=visibility&dir=desc) and hydrated on load, so it survives reloads and is shareable. Rows with missing data for the sorted column (unanalysed prompts) always sort last in both directions, via a small tested compareNullsLast helper. Default ordering (newest first) is unchanged when no sort param is set.
gkhngyk
force-pushed
the
feature/prompts-sortable-columns
branch
from
June 30, 2026 11:59
e13d514 to
9a9432e
Compare
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
Adds click-to-sort on the All Prompts table (
/dashboard/prompts?tab=all) for the visibility / mentions / volume / last-run columns, with the sort persisted to the URL for deep-linking.Behavior
ChevronUp/ChevronDown).?tab=all&sort=visibility&dir=descand hydrated on load, so it survives reloads and is shareable (mirrors the existingtabURL sync).sortparam.Implementation notes
aggregatePromptVolumeClustersgrouping is the Insights tab, not this table), so sorting is in-memory over the already-loaded rows — no server/pagination changes.useSearchParams; the header click writes it withrouter.replace(..., { scroll: false }), matching the page's existing tab sync.prompt-sort.ts+prompt-sort.test.ts).SortableHeadkeeps theInfoTipoutside the sort button so the help icon doesn't trigger a sort.Related issue
Closes #291
Type of change
feat— New featureHow to test
/dashboard/prompts?tab=all→ click Visibility / Mentions / Volume / Last run headers; the table sorts by that column (desc first).?tab=all&sort=visibility&dir=desc) into a new tab → the same sort is restored.sortparam → default newest-first ordering.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)