Is your feature request related to a problem? Please describe.
I'm using v0.11.0. It is not possible to specify persistor options in the ApolloOfflineClient constructor. When using with react native, it is necessary to use a 'wrapper' to force serialization of data saved in AsyncStorage since the default options passed to the persistor has the serialize option value as false which causes a problem when persisting the cache data.
Describe the solution you'd like
Instead of having to define a 'wrapper' which is just a workaround, not a solution. Allow to define optional persistor options through the ApolloOfflineClient constructor. This will even solve #273
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered:
@wtrocki about item 3. Yes, I can provide my own persistor, in fact I do. But there is an issue with that, which I do not fully understand yet. The thing is that when you first create the ApolloOfflineClient, you create a persistor with serialize: false and It doesn't matter if I later define my own, it is already created.
Then (and it's my guess) the time comes when the first persistor still tries to read/write the cache to AsyncStorage and the exception comes, since it's trying to write an object (array) to the store but it only supports Strings. That'll be the main issue with RN I think.
@JaEdmuva we'll definitely work on allowing you to pass down the persistor options through the constructor. In the meantime did you try following the steps for passing in a custom storage mechanism in our react native document? This storage mechanism might help you get past the error you are seeing. See https://offix.dev/docs/react-native#integration
@JaEdmuva we recently merged and released #306 which allows you to create your own CachePersistor object and pass it into the OfflineClient constructor. You can check the PR description or the client configuration docs to learn how to do it. It can be used with version 0.13.1