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

data inside combine is undefined when using useSuspenseQueries #7197

Closed
NMinhNguyen opened this issue Mar 29, 2024 · 1 comment · Fixed by #7215
Closed

data inside combine is undefined when using useSuspenseQueries #7197

NMinhNguyen opened this issue Mar 29, 2024 · 1 comment · Fixed by #7215
Labels

Comments

@NMinhNguyen
Copy link
Contributor

Describe the bug

The types for data when using useSuspenseQueries with combine say that it’s not undefined, but it appears that combine is called when individual queries still have isLoading: true (i.e. before the component unsuspends). I’m not sure if this is a typing bug, or whether combine shouldn’t be called until data is populated (this seems more reasonable to me).

Your minimal, reproducible example

https://codesandbox.io/p/devbox/elegant-wozniak-tgds5q?file=%2Fsrc%2Findex.tsx

Steps to reproduce

  1. Open repro link
  2. Notice an error right away: Cannot read properties of undefined (reading 'value')

Expected behavior

Either a TypeScript error or no runtime error.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: 123.0

Tanstack Query adapter

react-query

TanStack Query version

5.28.9

TypeScript version

5.4.3

Additional context

No response

@TkDodo
Copy link
Collaborator

TkDodo commented Apr 2, 2024

I'm pretty sure combine shouldn't run until the queries finish suspending. Will take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants