Skip to content

Prompts: open the All Prompts list sorted by visibility score, highest first #712

Closed

Description

@gkhngyk

Problem

The All Prompts table opens sorted by creation date, newest first. That is a convenient default, not a useful one: after the first week it tells the user nothing, and it answers a question nobody is asking on a visibility product's prompt list.

The table already sorts by visibility — the column header is clickable and the choice persists to the URL — so today every user who wants the obvious view has to click to get it, on every fresh visit that doesn't carry the query string.

Default to visibility, highest score first, so the list opens as a leaderboard: the prompts the brand is strongest on at the top, weakest further down.

Where it lives

  • Default ordering: prompts/page.tsx — the if (!activeSort) branch in filtered, currently createdAt descending
  • Sort state and URL sync: same file, activeSort / dir read from searchParams
  • Comparator: prompt-sort.ts

The part that is easy to get wrong

The header indicator has to agree with the default. activeSort is null when the URL carries no sort parameter, and the sort arrow only renders on the active column. Changing just the fallback ordering would leave the table sorted by visibility while every header still reads as unsorted — the user clicks Visibility expecting something to happen and gets the same order back. So the default has to make visibility the active sort, not merely the fallback comparison.

Re-clicking must still toggle to ascending, and the URL should keep behaving as it does now.

A deliberate consequence, not a bug

compareNullsLast sends null values to the bottom in both directions, on purpose — ascending shouldn't fill the top of the table with blank rows. A prompt that has never been tracked has no visibility score, so under this default newly added prompts sort to the bottom until their first run.

That is the correct behaviour and should stay, but it is worth knowing: someone who adds twenty prompts and reloads will find them at the end of the list rather than the top, which the previous newest-first default gave them for free. If that turns out to bother people in practice, the fix is a separate conversation about surfacing untracked prompts, not a change to the comparator.

Acceptance criteria

  • Opening the All Prompts tab with no query string sorts by visibility score, highest first.
  • The Visibility header shows itself as the active sort in that state.
  • Clicking Visibility toggles to ascending; clicking another column behaves exactly as it does today.
  • A shared or reloaded URL that already carries sort and dir still wins over the default.
  • Prompts with no visibility score remain at the bottom in both directions.

Activity

  1. added
    enhancement
    good first issue
    prompts
    on Aug 12, 2026
  2. Rithikmahadev12 commented on Aug 12, 2026

    @Rithikmahadev12

    I can implement this by initializing activeSort to 'visibility' and dir to 'desc' when no query parameters are present, and adjusting the header indicator logic to reflect that default state. I estimate the work at $10 USD, contingent upon the scope remaining as straightforward as the issue description indicates. Please confirm whether you would like me to proceed, and I will submit the changes within a day or two of getting the go-ahead. I am offering to handle this fix should it align with your current priorities.

  3. Pavel-glitch-ui commented on Aug 13, 2026

    @Pavel-glitch-ui

    Hi i can fix this!

  4. Pavel-glitch-ui commented on Aug 13, 2026

    @Pavel-glitch-ui

    @gkhngyk check it out

  5. Rithikmahadev12 commented on Aug 14, 2026

    @Rithikmahadev12

    Just following up — happy to go ahead on this once you give an explicit thumbs up on the $10 estimate. If the scope turns out bigger once I'm in the code I'll flag that before doing anything, but wanted a clear yes on the price before starting.

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 issueprompts

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions