Skip to content

Commit

Permalink
Merge branch 'main' into chore/update-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
manudeli authored Jan 13, 2025
2 parents d963530 + 2b55955 commit c060586
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,17 @@ export const PostListItem = (props: Post) => {
```

```tsx queries.ts
import { queryOptions } from '@suspensive/react-query'
import { infiniteQueryOptions } from '@suspensive/react-query'
import { getInfinitePosts } from './api'

export const postsInfiniteQueryOptions = () =>
queryOptions({
infiniteQueryOptions({
queryKey: ['posts'],
queryFn: ({ pageParam = 1 }) => getInfinitePosts(pageParam),
getNextPageParam: (lastPage, allPages) =>
lastPage.skip + lastPage.limit < lastPage.total
? allPages.length + 1
: undefined,
})
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,17 @@ export const PostListItem = (props: Post) => {
```

```tsx queries.ts
import { queryOptions } from '@suspensive/react-query'
import { infiniteQueryOptions } from '@suspensive/react-query'
import { getInfinitePosts } from './api'

export const postsInfiniteQueryOptions = () =>
queryOptions({
infiniteQueryOptions({
queryKey: ['posts'],
queryFn: ({ pageParam = 1 }) => getInfinitePosts(pageParam),
getNextPageParam: (lastPage, allPages) =>
lastPage.skip + lastPage.limit < lastPage.total
? allPages.length + 1
: undefined,
})
```

Expand Down

0 comments on commit c060586

Please sign in to comment.