TanStackT
TanStack3y ago
6 replies
urgent-maroon

Optimal data transformations without effecting query cache?

What is the vue alternative to useMemo described in https://tkdodo.eu/blog/react-query-data-transformations. computed does not allow specifying dependencies. I am thinking a watch could be used to implement the example in the blog post, by watching the length of the returned data but im not sure if theres a best practice for this thats different.

Generally I modifying the query cache if the modification is inherent to the data itself but if I need to make a modification for a one off use case or for a section of my app I can use a wrapper function or what the blog post calls a 'render function' that modifies the query data as needed and returns it or stores it in a pinia store.
Was this page helpful?