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

breaking: Change the fetcher argument to be consistent with the passed key #1864

Merged
merged 4 commits into from Apr 3, 2022

Conversation

shuding
Copy link
Member

@shuding shuding commented Feb 18, 2022

Currently useSWR([1, 2, 3], fetcher) will use the fetcher signature fetcher(a, b, c) => data. With this PR it changes to fetcher([a, b, c]) => data, which makes the argument consistent, and unblocks other features we want to add in the future.

This also simplifies the type definitions and inference a lot.

Planned as a breaking change in 2.0.

@shuding shuding added this to the 2.0 milestone Feb 18, 2022
@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 18, 2022

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 6ba30ea:

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

@huozhi huozhi self-assigned this Mar 6, 2022
@shuding shuding marked this pull request as ready for review April 3, 2022 15:28
@shuding shuding requested a review from huozhi as a code owner April 3, 2022 15:28
@shuding shuding merged commit 12cc327 into main Apr 3, 2022
@shuding shuding deleted the shu/f76b branch April 3, 2022 15:28
@huozhi huozhi removed their assignment Apr 3, 2022
This was referenced Apr 11, 2022
himanshiLt pushed a commit to himanshiLt/swr that referenced this pull request Jun 10, 2022
…d key (vercel#1864)

* change the fetcher argument to be consistent with the key

* fix test cases

* fix type checks
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