meenie
meenie3mo ago

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
meenie
meenieOP3mo ago
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?
lee
lee3mo ago
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
meenie
meenieOP3mo ago
Dope! Don't even have to think about this shit. It's wild lol. I thought Supabase made this easy lol.
Tiger 🐅
Tiger 🐅3mo ago
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

Did you find this page helpful?