morrys
released this
03 Nov 20:29
·
227 commits
to master
since this release
Breaking change
- renamed restore function in hydrate
- removed offlineOptions in constructor
- removed isRestored function, now exist only isRehydrated
- removed: automatic rollback management of the single failed mutation in the store (relay v6 & v7 no longer allows such integration)
- update peerDependency "relay-runtime": ">=6.0.0"
Improved (2.0.0)
- support relay v6.0.0 & v7.0.0
- added setOfflineOptions
- update dependency offline-first with new options
import { Network } from "relay-runtime";
import { RecordSource, Store, Environment } from "react-relay-offline";
const network = Network.create(fetchQuery);
const networkOffline = Network.create(fetchQueryOffline);
const manualExecution = false;
const recordSource = new RecordSource();
const store = new Store(recordSource);
const environment = new Environment({ network, store });
environment.setOfflineOptions({
manualExecution, //optional
network: networkOffline, //optional
start: async (mutations) => { //optional
console.log("start offline", mutations);
return mutations;
},
finish: async (mutations, error) => { //optional
console.log("finish offline", error, mutations)
},
onExecute: async (mutation) => { //optional
console.log("onExecute offline", mutation)
return mutation;
},
onComplete: async (options ) => { //optional
console.log("onComplete offline", options)
return true;
},
onDiscard: async ( options ) => { //optional
console.log("onDiscard offline", options)
return true;
},
onPublish: async (offlinePayload) => { //optional
console.log("offlinePayload", offlinePayload)
return offlinePayload
}
});
Fixed (2.0.1 / 2.0.2)
* update dependency cache-persist