relay: [Modern] cacheConfig.poll setting does not poll
If passing cacheConfig to QueryRenderer with a poll interval set, the function passed to Network.create does not execute on each poll interval. I believe this is a regression from v1.1.0 and is related to the refactoring of RelayEnvironment to use observables.
Reproducing
To demonstrate this is a regression, I’ve created two branches on a forked version of relay-examples. In polling-1.1, polling works as expected and in not-polling-1.4, polling does not work. Additionally, I confirmed when upgrading to v1.2.0, polling stops working. The only changes in these examples are modifications of relay library versions and console.logs.
Potential Causes
From diffing v1.1.0 and v1.2.0, I think observables were introduced in 1.2. From a few attempts at debugging, it appears to me this may be related to ConvertToExecuteFunction.js. I am not that familiar with observables, but the poll function on the observable is not invoking the fetchFn passed to Network.create.
Thanks for a great open source library, and would love to help on this one if it seems like a good beginner issue.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 9
- Comments: 16 (7 by maintainers)
I’ve managed to implemented it
It’s open source here: https://github.com/sibelius/relay-modern-network-deep-dive
There is also a medium post about it: https://medium.com/@sibelius/relay-modern-network-deep-dive-ec187629dfd3
now we need to improve Relay official docs
I think we can provide an example of
fetchfor network usingObservable, and explain that this is needed to make poll workthis was a breaking change on this on v2
can we close this?
Hi @Angry-Potato This is a simplified example of my relay environment: