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

Watching Drizzle "with"-queries, not supported? #426

Open
steveninety opened this issue Nov 30, 2024 · 3 comments
Open

Watching Drizzle "with"-queries, not supported? #426

steveninety opened this issue Nov 30, 2024 · 3 comments

Comments

@steveninety
Copy link

Doing a Drizzle watched query as per the docs, but instead of db.select(), using db.query.findMany({ with: { someRelationName: true }}), will result in all relations being returned (1) as JSON and (2) as an array of arrays of object-values instead of just... an array of objects.

Am I tapping into an unsupported feature, or is this a bug?

@Chriztiaan
Copy link
Contributor

Chriztiaan commented Nov 30, 2024

Hey @steveninety, I believe this is related to a known issue recently found with mapping the query to raw. Those relational queries depend on Drizzle to map the values back. We will be adding dedicated watch functions to both our Drizzle and Kysely packages to resolve this problem.

You can see a discord thread about it here.
A solution is in PR here, and should be available in the week.

@steveninety
Copy link
Author

Thanks Christiaan! Let's close this issue as soon as the update rolls out.

@Chriztiaan
Copy link
Contributor

Chriztiaan commented Dec 2, 2024

Hey @steveninety, @powersync/drizzle-driver@0.2.0 has been released which addresses this problem.
Documentation available for the new watch function on the DrizzleDb here: https://docs.powersync.com/client-sdk-references/javascript-web/javascript-orm/drizzle#watched-queries

Let me know if it resolves the issues for you.

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

No branches or pull requests

2 participants