Closed wtrocki closed 5 years ago
Ok.. After quick investigation of this I think that we can move even farther from client.mutate and make network state checkbeforehand. This will mean that there will be extra offlineFlag to context that will be triggering offline link to store mutations. I could not find any side impacts of this change and going to create quick prototype now
This is already addressed in https://github.com/aerogear/offix/pull/170
ping @darahayes
Definition of the problem
Currently, when performing offline mutate operation we going to apply optimistic response updates twice. This approach also requires users to pass the global cache update function, which is not convenient.
Solution
We can return error to the user and check network state directly in the helper making. Offline link then will be able to enqueue the changes as always but this time we going to know that this operation was marked as offline. This will help us to introduce server state aware offline cases where developers can specify some function that will quality changes to be enqueued to offline queue after network request.