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

Fix setting null cache in useSWRInfinite #1110

Merged
merged 2 commits into from
Apr 6, 2021
Merged

Conversation

shuding
Copy link
Member

@shuding shuding commented Apr 6, 2021

We call cache.set(pageSizeCacheKey, persistSize ? lastPageSizeRef.current : initialSize) inside useSWRInfinite whenever the firstPageKey changes, but the key can still be null. In that case we are setting cache.set(null, 1) which should be avoided.

@shuding shuding requested a review from huozhi April 6, 2021 14:24
@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 6, 2021

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 5e84c8a:

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

@shuding shuding merged commit 5c80c00 into master Apr 6, 2021
@shuding shuding deleted the fix-setting-null-cache branch April 6, 2021 14:59
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.

None yet

2 participants