Skip to content

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

🦋 Changeset detected

Latest commit: aa468aa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@powersync/tanstack-react-query Patch

Not sure what this means? Click here to learn what changesets are.

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

@Chriztiaan Chriztiaan changed the title Feat/tanstack use queries feat: Tanstack useQueries support Jun 23, 2025
@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.

@whygee-dev whygee-dev requested a review from Chriztiaan July 5, 2025 22:40
@Chriztiaan
Copy link
Contributor

Chriztiaan commented Jul 7, 2025

Last bit of housekeeping @whygee-dev , could you add a changeset entry? npm run changeset/pnpm changeset, and just add a nice patch entry describing what you did for the package :)

Might also need to update with main. And then we can get this in!

@whygee-dev whygee-dev force-pushed the feat/tanstack-use-queries branch from a87e6f6 to 25877a1 Compare July 7, 2025 09:34
@whygee-dev
Copy link
Contributor Author

Last bit of housekeeping @whygee-dev , could you add a changeset entry? npm run changeset/pnpm changeset, and just add a nice patch entry describing what you did for the package :)

Might also need to update with main. And then we can get this in!

done

Chriztiaan
Chriztiaan previously approved these changes Jul 7, 2025
@Chriztiaan
Copy link
Contributor

Hey @whygee-dev ! Really sorry for the long delay on this, appreciate your patience.

I've just pushed some updates (fixed imports and added explicit types + jsdoc examples). Would you mind giving it one last look when you get a chance?

Thanks again for the contribution!

@whygee-dev
Copy link
Contributor Author

@Chriztiaan

Added explicit types for useQueries() options. Added jsdoc examples.

LGTM ! Thank you

@Chriztiaan
Copy link
Contributor

Thanks for checking @whygee-dev,
I was doing a last check by incorporating your work in a demo. Do you know why error isn't being set here?

 const x = useQueries({
   queries: [
     { queryKey: ['todoLists'], query: 'SELECT * FROM lists' },
     { queryKey: ['todos'], query: 'sele' }
   ]
 });
image

@whygee-dev
Copy link
Contributor Author

whygee-dev commented Oct 18, 2025

Hmm I'm not able to reproduce while incorporating useQueries into the existing example-nextjs demo

  const [customersList, customers] = useQueries({
    queries: [
      { queryKey: ['customersList'], query: 'SELECT * FROM customers' },
      { queryKey: ['customers'], query: 'sele' }
    ]
  });

  console.log("customersList error", customersList.error);
  console.log("customers error", customers.error);
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