Replies: 2 comments 3 replies
-
Just use your fetcher function to not use the page. |
Beta Was this translation helpful? Give feedback.
3 replies
-
If it is not numeric, you will need to fetch the string id for the subsequent pages from the server in any case. Why not do so directly in your fetcher. Nobody tells you to even use the number. Here's our example adapted to that use case: const [nextPageId, setNextPageId] = createSignal('');
async function fetcher() {
let elements: string[] = [];
let res = await fetch(`/api/page/${nextPageId()}`);
if (res.ok) {
let json = await res.json();
// get the id from the next page from the data:
setNextPageId(json.nextPageId);
json.docs.forEach((b: any) => elements.push(b.title));
}
return elements;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using GraphQL and the Relay specification which prefers an opaque string cursor instead of a page number. Does anyone have any recommendations on how to implement using the current state or would this utility need to be updated to allow string | number?
Beta Was this translation helpful? Give feedback.
All reactions