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

feat: add isLoadingMore option for useSWRInfinite #2728

Closed

Conversation

devjiwonchoi
Copy link
Member

The initiative of isLoadingMore feature.

Description

Since isLoading is limited to the initial fetch, need a custom case for load more in infinite loading.

Didn't modify the current isLoading due to this comment:

swr/core/src/use-swr.ts

Lines 379 to 383 in bf1cd03

// It is in the `isLoading` state, if and only if there is no cached data.
// This bypasses fallback data and laggy data.
if (isUndefined(getCache().data)) {
initialState.isLoading = true
}

Reference

https://swr.vercel.app/examples/infinite-loading

Fixes:
#2410

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 27, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 5fd4744:

Sandbox Source
SWR-Basic Configuration
SWR-States Configuration
SWR-Infinite Configuration
SWR-SSR Configuration

@devjiwonchoi
Copy link
Member Author

@shuding Respectfully requesting for a review.

@devjiwonchoi devjiwonchoi deleted the feat/inifite-loading-more branch November 4, 2023 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant