Skip to content

fix: stop labeling the unordered default sort as "Newest" - #736

Open
smartcalsystems-sketch wants to merge 1 commit into
MergeFi:mainfrom
smartcalsystems-sketch:fix-misleading-newest-sort-label-702
Open

smartcalsystems-sketch wants to merge 1 commit into
MergeFi:mainfrom
smartcalsystems-sketch:fix-misleading-newest-sort-label-702

Conversation

@smartcalsystems-sketch

Copy link
Copy Markdown

Problem

SORT_LABELS.default = "Newest", but sortBounties's "default" case returns the array unchanged, and Bounty has no createdAt (or equivalent) field anywhere to sort by. The backend's listing query also has no ORDER BY, so the actual order is whatever Postgres's heap returns and can change between requests.

Fix

The issue offers two options: sort by createdAt (map it in the adapter), or rename the option. I went with renaming: adding a sort on a field that doesn't exist anywhere on Bounty today would mean guessing at a backend contract this frontend repo doesn't own, and a change that type-checks but silently no-ops against the real backend felt worse than an honest label. "Default order" replaces "Newest" so the UI stops claiming an ordering guarantee that isn't implemented. A real "Newest" sort is a good follow-up once createdAt is exposed end-to-end from mergefi-backend.

Testing

  • Added a regression test asserting the default sort's label never implies a chronological ordering (newest/oldest/recent) that the code doesn't actually provide.
  • Full bounty-query.test.ts suite: 23/23 passing (22 pre-existing + 1 new), zero regressions.
  • tsc --noEmit and eslint clean on all changed/consuming files.

Closes #702

…geFi#702)

SORT_LABELS.default was "Newest", but sortBounties's "default" case
returns the array unchanged, and Bounty has no createdAt (or equivalent)
field anywhere to sort by. The backend's listing query also has no
ORDER BY, so order is whatever Postgres's heap returns and can change
between requests.

A real chronological sort needs a createdAt field exposed end-to-end
from the backend first -- guessing at one here would be inventing a
backend contract this repo doesn't control. Taking the issue's other
suggested fix instead: stop the label from claiming an ordering that
isn't there.
@vercel

vercel Bot commented Oct 13, 2026

Copy link
Copy Markdown

@smartcalsystems-sketch is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The default sort is labelled 'Newest' but doesn't sort at all — order is whatever the backend returns

1 participant