facebook / relay

Relay is a JavaScript framework for building data-driven React applications.
https://relay.dev
MIT License
18.29k stars 1.81k forks source link

Local first architecture with Relay #2803

Open steida opened 5 years ago

steida commented 5 years ago

This is more about discussion and experiences. Feel free to close it if offtopic or wrong place.

Does anyone is trying to solve the same problem? Are Relay client extensions ready? Can we leverage Relay API with local schema? Thank you.

sibelius commented 5 years ago

You should look at this code https://github.com/morrys/react-relay-offline by @morrys

I think some of the strategies could be used to enable a local first architecture

client extensions is ready we just need to improve the docs (https://github.com/facebook/relay/issues/1656)

check this setLocal helper https://github.com/facebook/relay/issues/1656#issuecomment-509220117

you need to tell relay to not garbage collect some client only data

morrys commented 5 years ago

a feature present in relay-relay-offline, in my opinion, very useful that I hope to be able to natively integrate in relay is the addition of expire time and ttl present to the queries in the store.

I also implemented its management in the garbage collector.

This feature in addition to the fetch_policy store_only and store-or-network will give significant added value to the relay store.

https://github.com/relay-tools/relay-hooks/issues/5 in this issue there are the news that will be introduced in relay and many of these implemented in the relay-hooks library to help migrate their projects when they are will be available in the official relay version.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.