A Normalized cache in React Query
Hello, Im using Apollo Client for my query but isn't really optimal for my setup. Im using Supabase for the backend and the rest API is way more powerful than the GRAPHQL one. I really like how React Query work, but the only thing missing in react query is the normalized cache. Is this planned in future versions of react query? Or is there an additional package to achieve this?
Thx a lot =
4 Replies
rival-black•2y ago
have a look at normy:
https://tanstack.com/query/v5/docs/react/community/community-projects#normy
Community Projects | TanStack Query Docs
There are lots of community projects that build on top of React Query and use it to provide additional functionality or enhanced developer experience. Projects are listed in alphabetical order. If you have a project that you would like to add to this list, please open a PR!
Please note that these projects are entirely community maintained. If y...
jolly-crimsonOP•11mo ago
Is it stable ? I dont really understand how it work but seems very promising
Okay I reopen this post to icnrease my data normalization
My only problem right now with Normy, he only update cached data when mutation. Example : I already request the
playlist: 1
. If I use a mutation to change the title of my playlist: 1
its gonna work, my playlsit is updated everywhere. But, if the playlist: 1
have a new title and I make a query requesting a bunch of playlists
(including the playlist: 1
). If inside this query the playlist: 1
got a different title, isnt gonna change everywhere, because normy only update on mutation... There is a way to change that ?rival-black•11mo ago
Maybe open a discussion / issue in normy ? I think it should normalize in both cases but not sure
jolly-crimsonOP•11mo ago
ONly in mutation because with query it can cause performance issue (word of the creator of normy)