fix(admin): ensure content list pagination works correctly#380
fix(admin): ensure content list pagination works correctly#380kombuchapunk wants to merge 3 commits intoemdash-cms:mainfrom
Conversation
This fixes an issue where the "Load More" button would not appear in the admin content list, even when there were more items to load. Changes: - Always include the `limit` parameter in content list API requests, defaulting to 100 for better UX in admin lists - Make `getNextPageParam` more robust by explicitly validating that `nextCursor` is a non-empty string before returning it
100 items causes D1 SQL variable limit errors when hydrating SEO data. Server default of 50 works correctly with pagination.
|
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
Summary
The "Load More" button in the admin content list never appeared — even when collections had more items than a single page. Two bugs in
packages/admin/src/:getNextPageParamreturned an empty string instead ofundefined(router.tsx) — React Query treats any truthy return as "there's another page", but an empty-string cursor also prevented it from correctly settinghasNextPage = false. Now explicitly returnsundefinedwhen there is no next cursor.limitwas conditionally omitted from API requests (lib/api/content.ts) — when nolimitwas passed, the query param was skipped entirely, causing inconsistent server responses. Now always sendslimit(defaults to 100, capped server-side at 100).Additionally, the explicit
limit: 100in the query call was removed because D1 throws SQL variable limit errors when hydrating SEO data for 100 items. The server default of 50 works correctly with cursor-based pagination.Test plan
http://localhost:4321/_emdash/admin/content/posts