We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core, jsonapi, swr
@datx/core 2.5.1, @datx/jsonapi 2.5.1, @datx/swr 2.5.1
No response
All
const getPostComentsRelationshipPageQuery = (id?: string, index = 1, size = 4) => id ? ({ id, op: "getRelatedResources", type: `posts`, relation: "comments", queryParams: { sort: "-created", include: "post", fields: { posts: "id", }, custom: [ { key: "page[number]", value: String(index) }, { key: "page[size]", value: String(size) }, ], }, } as const satisfies IGetRelatedResourcesExpression<typeof Post>) : null;
const getKey = (pageIndex: number, previousPageData: CollectionResponse | null) => { if (!showComments || (previousPageData && previousPageData.data.length === 0)) return null; return getPostComentsRelationshipPageQuery(post?.id, pageIndex + 1, 4); }; const { data: comments, // <--------------- mutate: mutateComments, size, setSize, } = useDatxInfinite(getKey, { revalidateAll: true, });
Type of comments is CollectionResponse<PostModel>[] | undefined.
comments
CollectionResponse<PostModel>[] | undefined
Type of comments is CollectionResponse<CommentModel>[] | undefined.
CollectionResponse<CommentModel>[] | undefined
https://github.com/doroz0/soc-net-clone-nextjs/blob/main/src/components/Post.tsx#L38
The text was updated successfully, but these errors were encountered:
useDatxInfinite
DarkoKukovec
isBatak
kristian240
Successfully merging a pull request may close this issue.
Used libraries
core, jsonapi, swr
Library version(s)
@datx/core 2.5.1, @datx/jsonapi 2.5.1, @datx/swr 2.5.1
Sample API response (if relevant)
No response
Environments with the issue
All
Environments without the issue
No response
Current behavior
Type of
comments
isCollectionResponse<PostModel>[] | undefined
.Expected behavior
Type of
comments
isCollectionResponse<CommentModel>[] | undefined
.Reproduction steps
The text was updated successfully, but these errors were encountered: