Hello, is it possible to see, what data
Hello, is it possible to see, what data exactly added/updated in my useQuery?
5 Replies
Can you elaborate please?
If you've changed something with a mutation, you can potentially return the result of what was updated with table triggers,
For the query itself, I'm not quite sure how to go by this, I'd run a compare function and safe the previous data in a memo, I could dig deeper into the useQuery code and find out, but the first option is the simplest one
https://stack.convex.dev/triggers
From the convex-helpers package
Database Triggers
Triggers automatically run code whenever data in a table changes. A library in the convex-helpers npm package allows you to attach trigger functions t...
I'll look into it today, sounds interesting to figure out how this works
https://github.com/get-convex/convex-js/blob/main/src/react/use_queries.ts
GitHub
convex-js/src/react/use_queries.ts at main · get-convex/convex-js
TypeScript/JavaScript client library for Convex. Contribute to get-convex/convex-js development by creating an account on GitHub.
For example, I have a list of online status of users, and I want to know, which users status changed without to have to compare it with prev states
I thought maybe useQuery has something out of the box, to retrieve only the changed ids
I tried for like 20 min to figure it out, and I don't think I'm gonna put much more work into it,
this only returns undefined for me, which makes sense since the class is private and there's no getter for it,
localQueryResult is the cached version, you could potentially run a simple compare function,
I'd use a Set, and filter against the data that's not found, and return that elemnt,
you can potentially do this with react if you could find out how to track useMemo