How to manually update the registry store without a server request?

Let's say I have some data that I received through an endpoint without a graph, for example, from a third-party server (firebase).

How to place data in the local repository storage? Is there an easy way to add / edit / overwrite data in the relay repository directly without going through a request or mutation?

+5
source share
2 answers

The inaccessible RelayStoreData field is accessible from the Relay.Store instance and gives you direct access to the records contained in the repository. I did nothing with this, but you can try changing the cache directly as follows:

RelayStore._storeData._cachedStore._records[recordId][fieldName]=newValue

+3
source

I would use a serverless relay, locally defining your graphql schema and doing your API requests from your graphql schema the same way you would query a database in your schema.

https://github.com/relay-tools/relay-local-schema

0
source

All Articles