react-relay-offline: Allow offline execution of mutations that do not modify the store
I’ve just upgraded from 0.11.1 -> 1.0.2 (and upgraded Relay to v6 - I’ve also tried v7).
When I turn my connection off to test offline, on one screen I get this error TypeError: Cannot read property 'toJSON' of undefined
from the OfflineFirstRelay
file in relay-offline
.
It comes from this line:
var sinkPublish = environment
.getStore()
.getSource()
._sink.toJSON();
This only seems to happen on one screen, I have done some digging and can’t see specifically why this would error and other screens not. I can dive into this further, but just wanted to see if there was anything obvious I’ve missed in the upgrade.
My relay-offline
library in my yarn.lock
is at the right version "@wora/relay-offline@^2.0.4"
I have also followed your react-native example (e.g. I’ve added useRestore
above my QueryRenderer).
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (9 by maintainers)
Commits related to this issue
- Allow offline execution of mutations that do not modify the store issue https://github.com/morrys/react-relay-offline/issues/35 — committed to morrys/wora by morrys 4 years ago
Good 😉
Amazing - thanks Lorenzo! I’ll hopefully be able to give this a go tomorrow.
On Sun, Jan 12, 2020 at 11:28 AM Lorenzo Di Giacomo < notifications@github.com> wrote:
these days I try to sketch its implementation and release it on the weekend 😃
Sure…it’s a very simple one, which matches your hypothesis:
[createMutationPromise is just our wrapper for commitMutation]
As I said, we didn’t bother adding in an optimisticUpdate as
dateScreenViewed
presently does nothing in the UI. But can see it’s a bit pointless to return that value here.