Skip to content
New issue

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

docs(suspensive.org): correct queryOptions to infiniteQueryOptions in SuspenseInfiniteQuery example #1412

Merged
merged 1 commit into from
Jan 12, 2025

Conversation

SWARVY
Copy link
Contributor

@SWARVY SWARVY commented Jan 12, 2025

Overview

import { queryOptions } from '@suspensive/react-query'
import { getInfinitePosts } from './api'

export const postsInfiniteQueryOptions = () =>
  queryOptions({
    queryKey: ['posts'],
    queryFn: ({ pageParam = 1 }) => getInfinitePosts(pageParam),
  })

The queries.ts logic in the SuspenseInfiniteQuery component example on suspensive.org was using inappropriate queryOptions. This PR updates the example to use infiniteQueryOptions instead for better accuracy and relevance.

I referred to the getNextPageParam section in the useSuspenseInfiniteQuery part of this document.

import { infiniteQueryOptions } from '@suspensive/react-query'
import { getInfinitePosts } from './api'

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

PR Checklist

  • I did below actions if need
  1. I read the Contributing Guide
  2. I added documents and tests.

@SWARVY SWARVY requested a review from manudeli as a code owner January 12, 2025 13:22
Copy link

changeset-bot bot commented Jan 12, 2025

⚠️ No Changeset found

Latest commit: b37e231

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

coauthors bot commented Jan 12, 2025

People can be co-author:

Candidate Reasons Count Add this as commit message
@SWARVY #1412 1 Co-authored-by: SWARVY <[email protected]>
@codecov-commenter #1412 (comment) 1 Co-authored-by: codecov-commenter <[email protected]>
@gwansikk #1412 (review) 1 Co-authored-by: gwansikk <[email protected]>
@manudeli #1412 (review) 1 Co-authored-by: manudeli <[email protected]>

Copy link

vercel bot commented Jan 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
suspensive.org ❌ Failed (Inspect) Jan 12, 2025 1:38pm
v1.suspensive.org ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 12, 2025 1:38pm
visualization.suspensive.org ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 12, 2025 1:38pm

Copy link

vercel bot commented Jan 12, 2025

@SWARVY is attempting to deploy a commit to the Toss Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Collaborator

@gwansikk gwansikk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution 👀🦅

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.89%. Comparing base (07b6b77) to head (b37e231).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1412   +/-   ##
=======================================
  Coverage   73.89%   73.89%           
=======================================
  Files          70       70           
  Lines         590      590           
  Branches      131      131           
=======================================
  Hits          436      436           
  Misses        142      142           
  Partials       12       12           
Components Coverage Δ
@suspensive/react 100.00% <ø> (ø)
@suspensive/react-dom 95.55% <ø> (ø)
@suspensive/react-native 100.00% <ø> (ø)
@suspensive/react-query 83.47% <ø> (ø)
@suspensive/react-query-4 0.00% <ø> (ø)
@suspensive/react-query-5 0.00% <ø> (ø)
@suspensive/jotai 0.00% <ø> (ø)
@suspensive/codemods 42.85% <ø> (ø)

Copy link
Member

@manudeli manudeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Welcome your first contribution to suspensive ❤️

@manudeli manudeli merged commit 2b55955 into toss:main Jan 12, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants