Is there a way to preload Apollo's cache-inmemory with raw data?

280 Views Asked by At

We don't have server currently. We're using Apollo client purely on client side with apollo-link-state and apollo-link-rest. I want to prevent the loading state of the application as I can have the raw data I would get from the REST endpoint during site load. The closest I could get was using our customFetch handler where IF response exists in cache THEN return new Response() with that data. The problem is that this will trigger the loading state for a moment. I want to avoid this rerender in the application. I cannot use writeQuery() as it would need all the custom types and transformations applied before and the dataset is pretty complex. What I want is to feed my cache at initialization with raw, unprocessed data.

0

There are 0 best solutions below