react-relay-offline icon indicating copy to clipboard operation
react-relay-offline copied to clipboard

Offline Sync Query (DeltaSync)

Open robertpitt opened this issue 5 years ago • 7 comments

Hey,

Just looking at the redux persist/hydrate store, and feel as though the naming is a little off here, take a look at the following screenshot.

Screen Shot 2019-05-19 at 22 42 03

I would expect that AppQuery.{....} should contain the root operation, such as AppQuery. allCinemaDetails{ ... }.

robertpitt avatar May 19 '19 21:05 robertpitt

I have chosen the key nomenclature to better manage the garbage collector. For which use case would you like to have the root operation information?

morrys avatar May 20 '19 08:05 morrys

The use case for the root operation would be to be able to pre-emptily execute so that we can have an offline sync scenario.

Example being

  1. Open Application
  2. The following query is executed
query OfflineSyncQUery {
   cinemas(param: 1, param: 2) {
      ...CinimaView_cinima
      ...CinimaContact_infomation
   }
}
  1. Once the sync is complete, navigating to the view CinimaView would call the QueryRenderer that will attempt to find cinemas(param: 1, param: 2) in the root operations, if it exists then it will be served without going to the network.

robertpitt avatar May 20 '19 08:05 robertpitt

Do you mean a scenario similar to "https://docs.aws.amazon.com/en_us/appsync/latest/devguide/tutorial-delta-sync.html"?

This is a theme that I am placing myself in the "https://github.com/morrys/react-relay-appsync" repository and at the moment the best hypothesis is its implementation in the refetchContainer (DeltaSyncContainer or QueryRendererSync).

morrys avatar May 20 '19 09:05 morrys

Hey, is it possible for us to connect on a slack channel somewhere I can send you some documents I wrote on the internal ideas we had for how we thought this solution would play out?

robertpitt avatar May 20 '19 11:05 robertpitt

There is the channel https://graphql.slack.com and you can write me a DM

morrys avatar May 20 '19 12:05 morrys

we can discuss these on #relay channel there

I think more people want to collaborate on this

sibelius avatar May 20 '19 12:05 sibelius

maybe this could help with delta sync

https://github.com/zth/relay-utils#createmissingfieldshandler

missingFieldHandlers

sibelius avatar May 20 '19 13:05 sibelius