Load favorites 25 at a time with Load More #367

Closed
opened 2026-06-09 11:35:07 -05:00 by Codex · 1 comment
Member

Summary

Update the Favorites page so it initially loads only the newest 25 eligible favorite entries, then lets the user load 25 more at a time.

Current behavior

FavoriteController::show() loads every eligible favorite entry for the selected user with get(). The page currently orders by sort_order and id.

Desired behavior

  • Show the first 25 eligible favorites on initial page load.
  • Order favorites by favorites.created_at newest first, with a stable secondary order.
  • Add a Load More button similar to the existing /lists behavior.
  • Each Load More action appends the next 25 eligible favorites without replacing already loaded entries.
  • Hide the Load More button once all eligible favorites have been loaded.
  • Preserve the existing owner/viewer action behavior for Add to List, favorite, and wishlist buttons.
  • Keep public username views and the authenticated user's own /favorites view working.

Implementation notes

The /lists page already has a progressive Load More pattern in GameListController and resources/js/app.js. Reuse that approach where practical instead of introducing a separate pagination style.

Acceptance criteria

  • /favorites/{username?} initially renders at most 25 eligible favorite entries.
  • Entries are ordered by newest favorites.created_at first.
  • Clicking Load More appends the next 25 entries.
  • The Load More button is hidden when no more favorites are available.
  • Existing empty-state behavior still works.
  • Existing game action buttons continue to work on initially loaded and appended rows.
  • Feature tests cover the initial limit, newest-first ordering, loading more, and final-button hiding behavior.
## Summary Update the Favorites page so it initially loads only the newest 25 eligible favorite entries, then lets the user load 25 more at a time. ## Current behavior `FavoriteController::show()` loads every eligible favorite entry for the selected user with `get()`. The page currently orders by `sort_order` and `id`. ## Desired behavior - Show the first 25 eligible favorites on initial page load. - Order favorites by `favorites.created_at` newest first, with a stable secondary order. - Add a Load More button similar to the existing `/lists` behavior. - Each Load More action appends the next 25 eligible favorites without replacing already loaded entries. - Hide the Load More button once all eligible favorites have been loaded. - Preserve the existing owner/viewer action behavior for Add to List, favorite, and wishlist buttons. - Keep public username views and the authenticated user's own `/favorites` view working. ## Implementation notes The `/lists` page already has a progressive Load More pattern in `GameListController` and `resources/js/app.js`. Reuse that approach where practical instead of introducing a separate pagination style. ## Acceptance criteria - [x] `/favorites/{username?}` initially renders at most 25 eligible favorite entries. - [x] Entries are ordered by newest `favorites.created_at` first. - [x] Clicking Load More appends the next 25 entries. - [x] The Load More button is hidden when no more favorites are available. - [x] Existing empty-state behavior still works. - [x] Existing game action buttons continue to work on initially loaded and appended rows. - [x] Feature tests cover the initial limit, newest-first ordering, loading more, and final-button hiding behavior.
jimmyb self-assigned this 2026-06-10 10:34:44 -05:00
Author
Member

Implemented in f82bd1f (Load favorites progressively).

Notes:

  • FavoriteController::show() now cursor-paginates eligible favorites 25 at a time, ordered by favorites.created_at newest first with favorites.id as the stable secondary order.
  • The existing /favorites/{username?} route handles both full-page and Load More JSON requests via X-MVGL-Favorites-Load-More.
  • Favorite row markup is shared between the initial render and appended rows, preserving existing Add to List, favorite, and wishlist button behavior.
  • The Load More button removes itself once the final page returns next_url: null.

Verification:

  • php artisan test --compact tests/Feature/FavoriteTest.php - 27 passed
  • vendor/bin/pint --dirty --format agent - passed
  • npm run build - passed
Implemented in `f82bd1f` (`Load favorites progressively`). Notes: - `FavoriteController::show()` now cursor-paginates eligible favorites 25 at a time, ordered by `favorites.created_at` newest first with `favorites.id` as the stable secondary order. - The existing `/favorites/{username?}` route handles both full-page and Load More JSON requests via `X-MVGL-Favorites-Load-More`. - Favorite row markup is shared between the initial render and appended rows, preserving existing Add to List, favorite, and wishlist button behavior. - The Load More button removes itself once the final page returns `next_url: null`. Verification: - `php artisan test --compact tests/Feature/FavoriteTest.php` - 27 passed - `vendor/bin/pint --dirty --format agent` - passed - `npm run build` - passed
Codex 2026-06-10 11:36:48 -05:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MyVideoGameList/myvideogamelist.com#367
No description provided.