Just to get something straight in my
Just to get something straight in my head with Convex and the provided React hooks, if you do something stupid like render multiple of the same component in a
.map()
and inside each of those components is a useQuery()
with the same API endpoint and arguments, does the convex provider dedupe those queries in a way that it will only run a database query one time and then any subsequent useQuery()
calls will use a local version of that data?4 Replies
I've hooked up
convex-helpers/react/cache
, which I'm assuming will be the answer to this question.
Which is pretty badass, tbh. Because the caching problem is "solved", why isn't that just on by default?This is done already by the base convex client -- queries with the same args are deduped
convex-helpers/react/cache is a bit different: it keeps the queries cached even if all components that use them are (temporarily) unmounted
Dope! Don't even have to think about this shit. It's wild lol.
I thought Supabase made this easy lol.
exactly
use query
how many times u want
cached for u
i fucking l,ove this bit so much
its insane how little i need to think about performance when working with convex
i guess thats a good testimonial @Wayne lmfao