Skip to content

feat(prompts): sortable columns on All Prompts (visibility / mentions / volume / last run) with URL deep-link #291

Closed

Description

@gkhngyk

User story

As an account user, I want to sort by clicking the column headers (visibility, mentions, volume, last run) so I can instantly surface the weakest / strongest prompts.

Acceptance: ascending/descending toggle; the active sort is visually marked; the sort is written to the URL (deep link).

Where

The All Prompts table on /dashboard/prompts?tab=all. Today the column headers are static (a TableHead with a tooltip, ~line 103) — no sorting.

Why it's a good fit

  • The table data (volumes + visibility) is already loaded fully client-side into component state, so sorting can be done in memory — no server pagination or new endpoints.
  • The page already syncs state to the URL (tab param via useSearchParams + router), so writing sort/dir query params follows the existing pattern.

Proposed

  • Make these headers clickable to sort: visibility (avg_visibility_30d), mentions (total_mentions_30d), volume (est_ai_volume / total_google_volume), last run (last_checked).
  • Click toggles asc ⇄ desc; clicking a different column switches to it (default desc for "show me the extremes").
  • Show the active column + direction with a chevron (e.g. ChevronUp/ChevronDown) on the header.
  • Persist as URL query params, e.g. ?tab=all&sort=visibility&dir=desc, and hydrate from them on load (deep link / shareable).

Notes / edge cases

  • Null/unanalyzed rows last: prompts with no volume/visibility data (blank cells) should sort to the bottom regardless of direction, so ascending ("weakest first") doesn't put empty rows on top.
  • Grain: the table groups rows via aggregatePromptVolumeClusters — make sure the sort applies at the correct grain (cluster vs. row) and stays consistent with how rows are currently rendered.
  • Keep the default (current) ordering when no sort param is present.

Acceptance criteria

  • Clicking visibility / mentions / volume / last-run headers sorts the table by that column.
  • Re-clicking the active header toggles asc/desc; the active column + direction is visually indicated.
  • The sort is reflected in the URL and restored on reload / when the link is shared.
  • Rows with missing data for the sorted column appear last in both directions.
  • yarn lint / typecheck / format:check from web/ pass.

Activity

  1. added
    enhancement
    good first issue
    on Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions