Out-of-the-box features for remote data
Recently, libraries like React Query and React SWR have proposed a new approach to data fetching with tremendous benefits for the developer (mainly Caching & invalidation) as well as some other sophisticated features like:
- Automatic Request retries & deduplication,
- Automatic revalidation (on focus, on network recovery...) - which keeps the application more frequently in sync with the server
The problem with those libraries is that they are React hooks, and as a consequence, the data cycle becomes tightly coupled with the components.
I love how overmind comes with powerful tools out-of-the-box (like state machines). Since data fetching ends up being so intertwined with state management, are there any thoughts on bringing an out-of-the-box developer experience regarding data fetching with the features like these?
Would be awesome to have something like that. It's kind of like hte GraphQL integration. Really looking to see this coming if possible :)
Would be definitely great if we have native support for these.
Found this post https://imfeld.dev/writing/swr_with_xstate a couple of days ago and I plan to enhance my Overmind implementation in the same way.
Redux just announced something in this direction: https://rtk-query-docs.netlify.app/
This certainly sounds interesting! I think it has to come from the community cause it would require a ton of research on my end, but I would love to advice and help out if anyone has an idea and just want help to integrate it 😄 Or if there is a more generic library we can use (like we do with graphql)
It's been a few years now, so I'm curious what everyone interested in this ended up using as a solution.
Overmind is flexible enough that you could implement something similar yourself but it seems very wet when libs userSWR/react-query already have all that logic.