morrys / wora

Write Once, Render Anywhere. typescript libraries: cache-persist, apollo-offline, relay-offline, offline-first, apollo-cache, relay-store, netinfo, detect-network
https://morrys.github.io/wora/docs/introduction
MIT License
174 stars 4 forks source link

fix relay-store documentation #42

Closed morrys closed 4 years ago

morrys commented 4 years ago

The documentation on https://morrys.github.io/wora/docs/relay-store has not been updated with the changes made in these releases:

Example of use of relay-store:

import { RecordSource, Store } from '@wora/relay-store';
import { CacheOptions } from "@wora/cache-persist";
import { Environment } from 'relay-runtime';

const defaultTTL: number = 10 * 60 * 1000; // optional, default
const persistOptions: CacheOptions = { defaultTTL }; // optional, default
const persistOptionsRecords: CacheOptions = {}; // optional, default
const recordSource = new RecordSource(persistOptionsRecords);
const store = new Store(recordSource, persistOptions);
const environment = new Environment({network, store});

// ...

await store.hydrate();

Examples of integration with react-relay-offline https://github.com/morrys/offline-examples/tree/master/relay

morrys commented 4 years ago

included in the issue #31