Intended outcome:
During a long client side mutation, I would expect to be able to set local state to signify that a mutation is in flight (such as connecting to a device):
E.G.
Mutation: {
connect: async () => {
connectionState("connecting");
await new Promise(resolve => setTimeout(resolve, 3000));
connectionState("connected");
},
}
Actual outcome:
LocalVar changes do not propagate to the UI until the mutation resolver which initiated the local var change has finished. However, the older writeQuery interface does behave as expected.
If the intended outcome of LocalVars is to replace writeQuery, I would expect them to behave the same.
How to reproduce the issue:
https://codesandbox.io/s/elastic-bassi-njd3c
Click the Connect (write state) button to see the expected behaviour vs the Connect (local vars) button, which doesn't change state until the connect mutation has finished.
Versions
3.0.0-beta.38
Thanks @freshollie - we know about this, and are working on it.
The newer cache.makeVar Reactive Variable API supports this. Thanks!
Most helpful comment
Thanks @freshollie - we know about this, and are working on it.