Update Relay Store from data saved on cache for Offline mode

Update Relay Store from data saved on cache for Offline mode


0

I’m developing a React native app, and want to restore data saved on cache when the user opens the app again, but it’s offline.
I was able to get the latest store by using store.getSource() and save it as a serialised JSON to the device storage. I do also recover and unserialise it, but when I set the value on the record source and publish to the store:

recordSource.set('client:root', record['client:root'])
store.publish(recordSource);

It seems Relay doesn’t uses this to resolve the queries:

loadQuery({}, { fetchPolicy: 'store-or-network' });

When offline it will throw the error as the query returned no response. Anyone know what I missing here?


Load 6 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *