wasp icon indicating copy to clipboard operation
wasp copied to clipboard

Implement RTK-style cache invalidation via operations

Open Martinsos opened this issue 3 years ago • 3 comments

RTK - Redux Toolkit

Investigate first though

Martinsos avatar Apr 04 '22 14:04 Martinsos

Check whta react query has for this

Martinsos avatar Apr 04 '22 14:04 Martinsos

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.

Martinsos avatar Apr 05 '22 14:04 Martinsos

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).

sodic avatar Apr 26 '22 09:04 sodic