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(react-query): fix useSuspenseQueries broken result type (#7118) #7141

Closed
wants to merge 1 commit into from

Conversation

xdjoshuaaz
Copy link

@xdjoshuaaz xdjoshuaaz commented Mar 20, 2024

The type inference inside GetSuspenseResults<T> is missing SkipToken as a possible return type for queryFn.

This causes inference of the returned results of useSuspenseQueries to not work, defaulting to a TData of unknown.

This PR just quickly adds SkipToken in the remainder of the code to allow inference to work again.

Fixes issue #7118.

Copy link

vercel bot commented Mar 20, 2024

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

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
query ⬜️ Ignored (Inspect) Visit Preview Mar 20, 2024 10:12am

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 71d94c5:

Sandbox Source
@tanstack/query-example-angular-basic Configuration
@tanstack/query-example-react-basic-typescript Configuration
@tanstack/query-example-solid-basic-typescript Configuration
@tanstack/query-example-svelte-basic Configuration
@tanstack/query-example-vue-basic Configuration

Copy link

nx-cloud bot commented Mar 20, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 71d94c5. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


🟥 Failed Commands
nx affected --targets=test:format,test:sherif,test:knip,test:eslint,test:lib,test:types,test:build,build,test:attw --parallel=3

Sent with 💌 from NxCloud.

@TkDodo
Copy link
Collaborator

TkDodo commented Mar 20, 2024

Thanks. Can you please:

  • add a type test so that we make sure this doesn't break again in the future. useQueries.test-d.tsx should be the right place
  • can you please add the fix also to other adapters? The types for useQueries are pretty much copy-pasted to all adapters (yes, this can be simplified ... somehow, somewhen)

@andykog
Copy link
Contributor

andykog commented Mar 28, 2024

@TkDodo this PR is not active for 8 days, so I've opened another PR with tests: #7194
I believe this fix is not relevant for other adapters because they don't have useSuspenseQueries and createQueries don't have this issue

@TkDodo TkDodo closed this Apr 2, 2024
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