Replies: 1 comment
-
An update on this for anyone coming across it. It seems that what we where expecting to happen w/ the cache becoming sync'd between client and server just isn't supported (yet). This is really an apollo issue and is most noticed when trying to do offline cache syncing. In our use that wasn't what we where trying to achieve (currently) but is essentially the same issue: cache persistence across two separate query caches (client/server). Admittedly we're new to apollo and ssr to some degree but the core of the issue wasn't immediately evident to us based on what we where seeing. For anyone facing a similar issue the below links might point you into the right direction. apollo-cache-persist Suffice to say that if cache syncing is really what you're after it can be done but isn't well documented or supported by apollo client at this time. |
Beta Was this translation helpful? Give feedback.
-
I've been hunting this issue for some time now and can't figure out if it's on the apollo client side or inside vue apollo (ssr)... In our project I'm using ApolloQuery components where the variable set gets updated and a new query completes w/ the updated data returned, simple. This works really well on the client side and I hadn't had any issues w/ stale data until adding ssr. And I'm confident our ssr implementation follows the docs to a finite degree—What I'm finding now is the updated data never gets into the injected apollo state while the client does update the query results once the dom is loaded. This causes some unexpected behavior (ie flash of stale content and/or mismatch errors). I've chased this down a lot of rabbit holes pertaining to our specific project but in the end feel like it's the apollo ssr getStates method not returning the expected data that is the issue.
In entry-server when I log out
apolloProvider.clients.defaultClient.cache.extract()
found in the getStates method source code, I never get the updated data from the second query; it always and only returns the original query data :(Any info anyone can provide on this is so, so much appreciated!
Beta Was this translation helpful? Give feedback.
All reactions