-
Notifications
You must be signed in to change notification settings - Fork 100
Using apollo-cache-persist with apollo-link-state #170
Comments
I get similar results in my own application: I can see One thing I haven't tried is using That being said, improved documentation and examples seem to be needed. |
@tsnieman Unfortunatly, using CachePersistor doesn't works too. I found the cause of the problem, it's when using default values with apollo-link-state because it's writing these default values in the cache. What i'm doing for now to solve this problem is to avoid |
@jlietart @tsnieman What's worked for me is using |
Is using |
I tried the approach by @KevinDoom but I found that |
@KevinDoom or @deltaskelta Do you have any examples/code snippets I can take a look at? |
I am using gatsby, so the
|
Thanks @deltaskelta That helped me figure it out. I'm also attaching my code as an example for others. |
Has anyone found a better solution to this? |
I had a similar problem that was caused by calling
|
I just realised this as well and now I feel like an idiot. Everything works now :) |
I store a query Posts {
id
author { id ... } # User type
} And I have some defaults set up in the store for the default user with id When I boot up the app, my cache is restored via persistCache, but I end up with the default user, despite having an object cached by ID for the logged-in user in localstorage. I added some debug logs, and from that it looks like my app-shell component is connecting, then querying for data, before the cache is fully restored
Why, in this case, if a |
Just a note that may help someone, I have a isAuth call that is called by home/login screen and also the PrivateRoute component so refresh on private routes auths as well. Instead of doing the restore on root component mount I do it in my async isAuth call:
|
Hi guys,
Thanks for the great work with apollo-link-state.
I would like to use it with apollo-cache-persist but when i try on the todo example (https://github.com/apollographql/apollo-link-state/tree/master/examples/todo), it doesn't works:
The cache seems to be restored in the logs, but my app doesn't show the added todos after refreshing.
How can i get this work ?
Thanks
The text was updated successfully, but these errors were encountered: