-
Hi! In [1], the load more state works fine. It doesn't have any issue. The code is use for: Recent donations on profile page //hook
export const useCreatorDonationsReceived = (props: useCreatorDonationsReceivedProps) => {
return useInfiniteQuery(
[CREATORS_QUERIES.getDonations, { creator: props.slug }],
async ({ pageParam }) => {
return await graphQLClient(2).request(
getCreatorDonationsReceivedQuery,
getDonationsContainerQueryVariables({ ...props, page: pageParam }),
);
},
{
getNextPageParam: lastPage => {
return lastPage.transactions.pagination.next;
},
},
);
};
// format variables
const getDonationsContainerQueryVariables = ({ slug, type, page = 1 }: getCreatorDonationsReceivedProps) => {
return {
slug,
limit: DONATIONS_PER_PAGE,
page,
type,
};
};
// using the hook
const {
data,
error,
fetchNextPage,
hasNextPage,
isFetching,
isFetchingNextPage,
status,
} = useCreatorDonationsReceived({
slug,
type,
}); User Posts // hook
export const useCreatorPosts = ({ creator, props }: useCreatorPostsProps) => {
return useInfiniteQuery(
[CREATORS_QUERIES.getPosts, { creator }],
async ({ pageParam }) => {
return await graphQLClient().request(getCreatorPostsQuery, getPostsVariables({ ...props, page: pageParam }));
},
{
getNextPageParam: lastPage => {
return lastPage.allPosts.pagination.next;
},
},
);
};
// format variables
export const getPostsVariables = ({ creator, limit, page = 1 }: getCreatorPostsProps) => {
const vars = {
CreatorId: creator.ref,
page,
limit: limit || POSTS_PER_PAGE,
};
isDev && console.log({ creator, limit, page, vars });
return vars;
};
// using the hook
const { data, error, fetchNextPage, hasNextPage, isFetchingNextPage, status } = useCreatorPosts({
creator: creator.slug,
props: {
creator,
},
}); You can test it here https://beta.ku-di.com/ku-di/posts. As you can see, the result from api endpoint and the one the posts page are different. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
I am not seeing that. The pages have ids 5,6,7 in the first page, and 8,4,1 in the next page: what am I missing? It would also help to get a minimal codesandbox to reproduce the problem |
Beta Was this translation helpful? Give feedback.
I am not seeing that. The pages have ids 5,6,7 in the first page, and 8,4,1 in the next page:
what am I missing? It would also help to get a minimal codesandbox to reproduce the problem