Convenience wrapper for cursor-based paginated APIs. Auto-iterates using the cursor returned by getCursor. Stops when getCursor returns null or undefined.
getCursor
const result = await cursorFetch({ fetcher: ({ cursor }) => api.items({ cursor, perPage: 50 }), getCursor: (r) => r.nextCursor ?? null, getItems: (r) => r.data,}); Copy
const result = await cursorFetch({ fetcher: ({ cursor }) => api.items({ cursor, perPage: 50 }), getCursor: (r) => r.nextCursor ?? null, getItems: (r) => r.data,});
Convenience wrapper for cursor-based paginated APIs. Auto-iterates using the cursor returned by
getCursor. Stops whengetCursorreturns null or undefined.