Skip to content

feat: Tanstack useQueries support #642

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

whygee-dev
Copy link
Contributor

@whygee-dev whygee-dev commented Jun 22, 2025

This PR adds support for Tanstack's useQueries hook (see API and parallel queries).

This allows grouping of queries and combining results. The new useQueries test suite provides good examples of how this can be used.

Copy link

changeset-bot bot commented Jun 22, 2025

⚠️ No Changeset found

Latest commit: 7479e96

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Chriztiaan Chriztiaan changed the title Feat/tanstack use queries feat: Tanstack useQueries support Jun 23, 2025
…liminate duplication between useQueries & useQuery
@whygee-dev whygee-dev requested a review from Chriztiaan June 28, 2025 22:10
@Chriztiaan
Copy link
Contributor

This looks better, I'd like to retest it after we merge the incremental watch PR.

expect(result.current).toContain('SELECT 1');
expect(result.current).toContain(1);
expect(result.current).toContain('SELECT 2');
expect(result.current).toContain(2);
Copy link
Contributor

@Chriztiaan Chriztiaan Jul 1, 2025

Choose a reason for hiding this comment

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

I have been looking at the docs here: https://tanstack.com/query/latest/docs/framework/react/reference/useQueries#combine

Based on that I don't really understand why we expect/want the query or parameters to be in the result at all. I would suggest also mocking a result in here so that we can see how combine works with actual data.

await waitFor(() => {
const results = result.current as any[];
expect(results[0].data[0].test).toEqual('custom');
expect(results[1].data[0]).toEqual('SELECT 2');
Copy link
Contributor

Choose a reason for hiding this comment

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

Echoing the previous comment, I logged what we have for the original useQuery implementation. This seems inconsistent, am I missing something?
image

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.

2 participants