-
Notifications
You must be signed in to change notification settings - Fork 30
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
Comments
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. |
Thanks Christiaan! Let's close this issue as soon as the update rolls out. |
Hey @steveninety, Let me know if it resolves the issues for you. |
Thank you for the quick work! I just had time to test things out and so far so good, lots of boilerplate gone! And being able to call .watch on the drizzle db instead of the powersync db clears up a possible point of confusion too. I just see one mistake which is that the result parameter in onResult is inferred as an {}[] in .findFirst() and a {}[][] in .findMany(). Whereas findFirst does indeed return an {}[], the findMany also returns an {}[] and not an {}[][]. Beside that, I think it's fair to assume that they should have been an {} and {}[] in findFirst and findMany respectively. But I can work around it for now! |
Fixed by #430
|
Doing a Drizzle watched query as per the docs, but instead of
db.select()
, usingdb.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?
The text was updated successfully, but these errors were encountered: