Skip to content

Improve theme list ordering: sort newest to oldest within each role group - #8192

Open
krjo wants to merge 1 commit into
Shopify:mainfrom
krjo:theme-list-newest-first
Open

Improve theme list ordering: sort newest to oldest within each role group#8192
krjo wants to merge 1 commit into
Shopify:mainfrom
krjo:theme-list-newest-first

Conversation

@krjo

@krjo krjo commented Jul 28, 2026

Copy link
Copy Markdown

WHY are these changes introduced?

Theme lists shown by the CLI (theme list and the interactive theme picker used
by theme push, theme pull, theme open, etc.) display themes in the order
returned by the Admin API, which is creation order — oldest first. On stores with
many themes (e.g. 100+), the newest themes — the ones developers actually need to
see or push to — are at the very bottom, requiring a lot of scrolling and wasted time.

WHAT is this pull request doing?

Sorts theme lists newest to oldest, while keeping the existing role grouping
(live → unpublished → development).

All theme list displays funnel through fetchStoreThemes in
packages/theme/src/cli/utilities/theme-selector/fetch.ts, which previously
sorted only by role and let the API's oldest-first order leak through within each
group. The comparator (byRolebyRoleThenNewest) now adds an ID-descending
tiebreaker — theme IDs increase monotonically, so a higher ID means a newer
theme. No API or schema changes needed.

This changes ordering in one place for both the theme list output and every
interactive theme picker (push, pull, open, publish, rename, delete,
duplicate, info).

How to test your changes?

  1. Run pnpm shopify theme list --store <store> against a store with several
    themes — themes should appear newest first within each role group, with the
    live theme at the top.
  2. Run pnpm shopify theme open --store <store> without --theme — the picker
    should list themes newest first within each role group.
  3. Unit tests: pnpm vitest run src/cli/utilities/theme-selector/fetch.test.ts
    from packages/theme — includes a new test asserting newest-first order
    within role groups.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

@aswamy aswamy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the current approach just does Role grouping then random ordering, i think this is a fair change. I tested it out too and it looks good 👍

Thank you for your contribution.

@graygilmore graygilmore left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @krjo! Love the change.

Make sure to sign the CLA so that we can merge it once CI passes.

@EvilGenius13

Copy link
Copy Markdown
Contributor

I like this. The change makes sense. Tested the build as well and worked fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants