Relays can certainly be used with Flux, and we talked with many developers who successfully use them together. The general scheme is to provide Relay with its own server data cache and manage server communications and use Flux to store and update data only for the client.
Reading relay data from a stream
If Flux stores need access to server data, they can use the API Relay.Storeto retrieve data from the server and read from the cache:
var query = Relay.createQuery(Relay.QL`query { ... }`, {var: 'value'});
Relay.Store.primeCache({query}, readyState => {
if (readyState.done) {
var data = Relay.Store.readQuery(query)[0];
}
});
Check Relay Cache
The relay does not support direct debugging support while traveling. However, we are actively working on the developer tools for Relay, and the initial version of this should be available soon. Meanwhile, there are several options for checking the status of the cache:
- . ,
RelayStoreData.getDefaultInstance().injectCacheManager(...) ( , API , API- ). CacheManager - , , -, , . , , JSON-. , , . - , . , .