wasp
wasp copied to clipboard
Implement RTK-style cache invalidation via operations
RTK - Redux Toolkit
Investigate first though
Check whta react query has for this
Solves 90% of what people need regarding query invalidation / client-server state management, making it elegant and cool to work with them → stuff just works! As one RTK user said → such simple solution for such a complex problem.
This is how RTK does it: https://redux-toolkit.js.org/rtk-query/usage/automated-refetching . I don't know if react-query also added smth to support this -> they didn't have it in v2 from what I know, maybe they do have smth now.
I also talked a lot about this idea in https://github.com/wasp-lang/wasp/issues/63, first before I knew about RTK, and then after I learned about it, so give it a read, there are different ideas there, all converging to this RTK style approach.
I took a look at the link and talked with Martin in person. RTK's system makes a lot of sense to us. React query does provide something similar with query keys, albeit in a less flexible way. Still, we can implement tags with react-query under the hood.
For example, we can start by introducing resources that aren't entities (perhaps with a separate Wasp declaration).