Re:Clean Front End Architecture with SvelteKit
by MrJohz on Monday April 17, 2023 @01:38AM
(#35597181)
That's the purpose of the in-app request caching layer. Another way to see it is that you do have state in a separate store, it's just that you have one piece of state for each resource that can be requested. So it's not that all the components are requesting the /users resource, it's more that all the components a requesting the value of the /users store, and the /users store fetches the data once and determines whether the data is loading, present, needs to be updated, etc.
[ Parent
| on HN ]
Re:Clean Front End Architecture with SvelteKit
by bayesian_horse on Monday April 17, 2023 @03:38AM
(#35597792)
That caching layer sounds like a footgun.
RTK Query does something similar, offering multiple ways to initiate, update and use the data of the queries.