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(types): use react 18 types #3482

Merged
merged 7 commits into from Apr 8, 2022
Merged

Conversation

TkDodo
Copy link
Collaborator

@TkDodo TkDodo commented Apr 8, 2022

No description provided.

@vercel
Copy link

vercel bot commented Apr 8, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tanstack/react-query/9b98tPTHwh2CpWQjbbxgX9sp1z4h
✅ Preview: https://react-query-git-fork-tkdodo-feature-react-18-types-tanstack.vercel.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 8, 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 effcf06:

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

@@ -147,7 +147,7 @@ describe('PersistQueryClientProvider', () => {

return (
<div>
<h1>{state.data}</h1>
<h1>{String(state.data)}</h1>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@artysidorenko I think the react 18 type upgrades have shown an issue with the types of useQueries: Here, the type of state.data is inferred to string | Promise<string> | undefined, which cannot be rendered.

I will create a separate issue for this with a failing test case, just to let you know :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

follow-up issue: #3483

move the null coercion into the String constructor
@codecov
Copy link

codecov bot commented Apr 8, 2022

Codecov Report

Merging #3482 (effcf06) into beta (13dbb27) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             beta    #3482      +/-   ##
==========================================
- Coverage   96.94%   96.94%   -0.01%     
==========================================
  Files          46       46              
  Lines        2391     2390       -1     
  Branches      714      714              
==========================================
- Hits         2318     2317       -1     
  Misses         71       71              
  Partials        2        2              
Impacted Files Coverage Δ
src/devtools/useLocalStorage.ts 96.00% <100.00%> (ø)
src/reactjs/Hydrate.tsx 100.00% <100.00%> (ø)
src/reactjs/QueryErrorResetBoundary.tsx 100.00% <100.00%> (ø)
src/reactjs/tests/utils.tsx 97.72% <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 13dbb27...effcf06. Read the comment docs.

because technically, it could live next to your App, as long as it's under the Provider:

<QueryClientProvider>
  <Hydrate />
  <App />
</QueryClientProvider>
@TkDodo TkDodo merged commit 58a9fe9 into TanStack:beta Apr 8, 2022
@TkDodo TkDodo deleted the feature/react-18-types branch April 8, 2022 09:26
@tannerlinsley
Copy link
Collaborator

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

The release is available on:

Your semantic-release bot 📦🚀

@symbiont-matthew-pirocchi

@tannerlinsley Any chance we could get a fix for 3.x as well?

@TkDodo
Copy link
Collaborator Author

TkDodo commented Apr 11, 2022

Any chance we could get a fix for 3.x as well?

Why do you want to use react18 with react-query 3.x? Imo this is just asking for troubles as soon as you start to use concurrent features. They will not work in all cases with v3. If you want to use react18, please use v4.

@symbiont-matthew-pirocchi

Why do you want to use react18 with react-query 3.x? Imo this is just asking for troubles as soon as you start to use concurrent features. They will not work in all cases with v3. If you want to use react18, please use v4.

Thanks, I missed that 3.x isn't intended to work with react18.

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

3 participants