I'm building a web app that has a bunch of settings a user can change and some lists that are fetched from the server using GraphQL. If a user is logged in I want to store the settings on the database as well as the global state. If a user is not logged in I want to simply store the data globally and not make any calls to the backend.
I'm currently using Redux-Toolkit for my state management but it doesn't cache the results. The list and each of the list-items content can be quite large so caching is definitely a good idea. How would I go about doing that? I am thinking of some sort of Middleware that checks whether a user is authenticated and based on that makes calls to the backend or not. But I haven't found the right technology stack for that yet. Apollo Client seems to have a huge bundle size, but it would offer handling both states at once, Redux has no caching, but is popular and easy to use with its Toolkit, urql seems to be on the decline looking at its download statistics, however its smaller and offers much what Apollo Client can do. Is there a way to handle this elegantly?