Skip to content

Search and sort the games list - #231

Closed
engleek wants to merge 1 commit into
mainfrom
feat/games-search-sort
Closed

engleek wants to merge 1 commit into
mainfrom
feat/games-search-sort

Conversation

@engleek

@engleek engleek commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #206. (Rebuilt on main now that #229 is merged: a single commit.)

/games could only be filtered by tag, and always listed recently updated games first.

Change

  • Search (?q=): debounced (300 ms). It matches the name or the description, case-insensitive (Prisma contains, mode: 'insensitive'). I chose that over the full-text helper because it combines simply with the tag ANDs. Blank means no search.

  • Sort (?sort=):

    • updated, recently updated: the default, and the old order;
    • newest, recently added;
    • name, name A–Z.

    orderBy is picked from a whitelist, so unknown values fall back to the default. An id tiebreak keeps infinite-scroll pages from overlapping when values tie.

  • Tag filters keep q and sort when toggled. Before, setSearchParams({ tags }) dropped every other parameter.

  • Tag counts follow the search, since they share its where.

  • Layout: the search box and sort select sit above the tag filter. On a phone they wrap with no horizontal scroll; I checked at 375px.

Tests

A new e2e test:

  • checks ?sort=name orders the cards A–Z and the select shows it;
  • types a word from a game's name: the URL gains q, keeps sort, and only matching games remain;
  • toggles a tag, which keeps both q and sort;
  • checks ?sort=bogus still renders;
  • scrolls to load the next page and checks the whole list is still in name order.

On main: it fails. Locally: the full e2e suite (39) and the unit and story tests (51) pass.

🤖 Generated with Claude Code

/games could only be filtered by tag and always listed recently updated
games first.

Add a search box (?q=, debounced, matching name or description, case-
insensitive) and a sort control (?sort= updated, newest or name; unknown
values fall back to updated, and orderBy is picked from a whitelist).
Both combine with the tag filters, which now keep the other parameters
when toggled, and with infinite scroll; an id tiebreak keeps pages from
overlapping.

Fixes #206.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@engleek

engleek commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #249, which merged this change into main.

@engleek engleek closed this Oct 4, 2026
@engleek
engleek deleted the feat/games-search-sort branch October 9, 2026 20:14
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.

Games: add search and sorting to the list page

1 participant