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(queryClient): make sure that setQueryData can return undefined from the updater function on type level #3615

Merged
merged 1 commit into from
May 14, 2022

Conversation

TkDodo
Copy link
Collaborator

@TkDodo TkDodo commented May 14, 2022

the only runtime tests we had didn't use the previous value, so the generic defaults to unknown; the TS error becomes apparent when providing a generic to setQueryData

…om the updater function on type level

the only runtime tests we had didn't use the previous value, so the generic defaults to unknown; the TS error becomes apparent when providing a generic to setQueryData
@vercel
Copy link

vercel bot commented May 14, 2022

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

Name Status Preview Updated
react-query ✅ Ready (Inspect) Visit Preview May 14, 2022 at 6:30PM (UTC)

@codesandbox-ci
Copy link

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 9d5931a:

Sandbox Source
tannerlinsley/react-query: basic Configuration
tannerlinsley/react-query: basic-typescript Configuration

@codecov
Copy link

codecov bot commented May 14, 2022

Codecov Report

Merging #3615 (9d5931a) into beta (0085137) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             beta    #3615   +/-   ##
=======================================
  Coverage   96.93%   96.93%           
=======================================
  Files          48       48           
  Lines        2383     2383           
  Branches      709      709           
=======================================
  Hits         2310     2310           
  Misses         71       71           
  Partials        2        2           
Impacted Files Coverage Δ
src/core/queryClient.ts 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0085137...9d5931a. Read the comment docs.

@TkDodo TkDodo merged commit 35a40ec into TanStack:beta May 14, 2022
@TkDodo TkDodo deleted the feature/fix-setQueryData-type branch May 14, 2022 20:50
@tannerlinsley
Copy link
Collaborator

🎉 This PR is included in version 4.0.0-beta.12 🎉

The release is available on:

Your semantic-release bot 📦🚀

@vladyslavNiemtsev
Copy link

Hi, guys!
I noticed the same problem. but for setQueriesData.

@TkDodo
Copy link
Collaborator Author

TkDodo commented May 29, 2022

@vladyslavNiemtsev good point, it's missing there as well. would you like to contribute it?

@TkDodo
Copy link
Collaborator Author

TkDodo commented May 30, 2022

@vladyslavNiemtsev
Copy link

@TkDodo Thanks for this quick PR!

@juunzzi
Copy link

juunzzi commented Aug 4, 2022

hi i'm juunzzi and euijinkk

우리도 이 문제에 직면했는데 이 풀리퀘 수정 사항을 현재 react-query에서는 사용할 수 없더라구 이 함수의 타이핑 자체를 조금 수정해서 사용하려 하고 있어!

우리가 먼저 contributor가 되고 싶었는데 아쉽다...

얼른 베타버젼 배포해줘 (4.0.0에서 사용할 수 있는 줄 몰랐네.. 최신 버전에는 반영되있더라 우리도 업그레이드 하거나 타입을 수정해서 사용하거나 해야겠어)

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.

None yet

4 participants