···11+---
22+'@urql/exchange-graphcache': minor
33+---
44+55+Add `onCacheHydrated` as an option for the `StorageAdapter`
+8-7
docs/api/graphcache.md
···178178> **NOTE:** Offline Support is currently experimental! It hasn't been extensively tested yet and
179179> may not always behave as expected. Please try it out with caution!
180180181181-| Method | Type | Description |
182182-| --------------- | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
183183-| `writeData` | `(delta: SerializedEntries) => Promise<void>` | This provided method must be able to accept an object of key-value entries that will be persisted to the storage. This method is called as a batch of updated entries becomes ready. |
184184-| `readData` | `() => Promise<SerializedEntries>` | This provided method must be able to return a single combined object of previous key-value entries that have been previously preserved using `writeData`. It's only called on startup. |
185185-| `writeMetadata` | `(json: SerializedRequest[]) => void` | This provided method must be able to persist metadata for the cache. For backwards compatibility it should be able to accept any JSON data. |
186186-| `readMetadata` | `() => Promise<null \| SerializedRequest[]>` | This provided method must be able to read the persisted metadata that has previously been written using `writeMetadata`. It's only called on startup. |
187187-| `onOnline` | `(cb: () => void) => void` | This method must be able to accept a callback that is called when the user's device comes back online. |
181181+| Method | Type | Description |
182182+| ----------------- | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
183183+| `writeData` | `(delta: SerializedEntries) => Promise<void>` | This provided method must be able to accept an object of key-value entries that will be persisted to the storage. This method is called as a batch of updated entries becomes ready. |
184184+| `readData` | `() => Promise<SerializedEntries>` | This provided method must be able to return a single combined object of previous key-value entries that have been previously preserved using `writeData`. It's only called on startup. |
185185+| `writeMetadata` | `(json: SerializedRequest[]) => void` | This provided method must be able to persist metadata for the cache. For backwards compatibility it should be able to accept any JSON data. |
186186+| `readMetadata` | `() => Promise<null \| SerializedRequest[]>` | This provided method must be able to read the persisted metadata that has previously been written using `writeMetadata`. It's only called on startup. |
187187+| `onOnline` | `(cb: () => void) => void` | This method must be able to accept a callback that is called when the user's device comes back online. |
188188+| `onCacheHydrated` | `() => void` | This method will be called when the `cacheExchange` has finished hydrating the data coming from storage. |
188189189190These options are split into three parts:
190191
···3535 * @defaultValue `7` days
3636 */
3737 maxAge?: number;
3838+ /** Gets Called when the exchange has hydrated the data from storage. */
3939+ onCacheHydrated?: () => void;
3840}
39414042/** Sample storage adapter persisting to IndexedDB. */
···219221 () => batch
220222 );
221223 },
222222-224224+ onCacheHydrated: opts.onCacheHydrated,
223225 onOnline(cb: () => void) {
224226 if (callback) {
225227 window.removeEventListener('online', callback);
+2
exchanges/graphcache/src/types.ts
···980980 * will cause all failed mutations in the queue to be retried.
981981 */
982982 onOnline?(cb: () => void): any;
983983+ /** Called when the cache has been hydrated with the data from `readData` */
984984+ onCacheHydrated?(): any;
983985}
984986985987/** Set of keys that have been modified or accessed.