Skip to content

Conversation

@sanny-io
Copy link
Contributor

@sanny-io sanny-io commented Oct 21, 2025

This uses type inference rather than code generation. Final implementation will look something like this:

import { useHooks } from '@zenstackhq/tanstack-query';
import { schema } from '@/zenstack/schema';

// in component
...
const { user: userQuery } = useHooks(schema);
// signature of `useFindMany` is inferred from schema
const { data: users } = userQuery.useFindMany();

@coderabbitai
Copy link

coderabbitai bot commented Oct 21, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@genu
Copy link
Contributor

genu commented Oct 21, 2025

Do we need to distinguish between the flavor of hooks to use here? (React, vs vue, etc)

This may not necessarily work outside of a react context.

@sanny-io
Copy link
Contributor Author

@genu this PR is focusing on React, but because it is the first target being developed for v3, there is going to be some groundwork laid for the others.

I think the common parts of the integration are going to be very similar to how it was in v2.

@ymc9
Copy link
Member

ymc9 commented Oct 23, 2025

Hey @sanny-io , I didn't know it was you on discord 🤣 . Thanks for the effort and can't wait to try it out!

@ymc9
Copy link
Member

ymc9 commented Oct 24, 2025

Just a heads up, I'm renaming "@zenstackhq/runtime" package to "@zenstackhq/orm".

@sanny-io
Copy link
Contributor Author

sanny-io commented Oct 29, 2025

Quick update regarding this PR: good progress has been made on the type inference for mutations and queries, but I've been dealing with the intellisense becoming unacceptably slow because the compiler is struggling with the types. The unfortunate thing is that a lot of the types in this PR build on top of one another, so fixing the bottleneck is proving to be quite difficult.

I'm closing this for now, but I'll keep experimenting to see if I can get it right. I know this is a much anticipated feature, so if anyone else wants to take a shot at it, I don't wanna be the holdup. My branch won't be deleted, and if anyone has any questions, I'm here to answer.

@sanny-io sanny-io closed this Oct 29, 2025
@ymc9
Copy link
Member

ymc9 commented Oct 30, 2025

Quick update regarding this PR: good progress has been made on the type inference for mutations and queries, but I've been dealing with the intellisense becoming unacceptably slow because the compiler is struggling with the types. The unfortunate thing is that a lot of the types in this PR build on top of one another, so fixing the bottleneck is proving to be quite difficult.

I'm closing this for now, but I'll keep experimenting to see if I can get it right. I know this is a much anticipated feature, so if anyone else wants to take a shot at it, I don't wanna be the holdup. My branch won't be deleted, and if anyone has any questions, I'm here to answer.

Thanks for the update @sanny-io . No worries, and I appreciate your effort put into this. I'm about to finish migrating server adapters to v3 and then will probably look into tanstack query code.

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.

3 participants