Skip to content

Commit 439a744

Browse files
author
Ben Grynhaus
committed
docs: update docs for createAsyncStoragePersistor and createWebStoragePersistor
1 parent 7b7391d commit 439a744

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

docs/src/pages/plugins/createAsyncStoragePersistor.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ interface CreateAsyncStoragePersistorOptions {
6060
/** To avoid localstorage spamming,
6161
* pass a time in ms to throttle saving the cache to disk */
6262
throttleTime?: number
63+
/** How to serialize the data to storage */
64+
serialize?: (client: PersistedClient) => string
65+
/** How to deserialize the data from storage */
66+
deserialize?: (cachedString: string) => PersistedClient
6367
}
6468

6569
interface AsyncStorage {
@@ -75,5 +79,7 @@ The default options are:
7579
{
7680
key = `REACT_QUERY_OFFLINE_CACHE`,
7781
throttleTime = 1000,
82+
serialize = JSON.stringify,
83+
deserialize = JSON.parse,
7884
}
7985
```

docs/src/pages/plugins/createWebStoragePersistor.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ interface CreateWebStoragePersistorOptions {
5757
/** To avoid spamming,
5858
* pass a time in ms to throttle saving the cache to disk */
5959
throttleTime?: number
60+
/** How to serialize the data to storage */
61+
serialize?: (client: PersistedClient) => string
62+
/** How to deserialize the data from storage */
63+
deserialize?: (cachedString: string) => PersistedClient
6064
}
6165
```
6266

@@ -66,5 +70,7 @@ The default options are:
6670
{
6771
key = `REACT_QUERY_OFFLINE_CACHE`,
6872
throttleTime = 1000,
73+
serialize = JSON.stringify,
74+
deserialize = JSON.parse,
6975
}
7076
```

0 commit comments

Comments
 (0)