Skip to content

Commit 19df12f

Browse files
authored
fix(javascript): Added warning in comment (#5961)
1 parent b417cff commit 19df12f

File tree

1 file changed

+12
-4
lines changed
  • clients/algoliasearch-client-javascript/packages/client-common/src/types

1 file changed

+12
-4
lines changed

clients/algoliasearch-client-javascript/packages/client-common/src/types/transporter.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,18 @@ export type TransporterOptions = {
9898
requester: Requester;
9999

100100
/**
101-
* The cache of the requests. When requests are
102-
* `cacheable`, the returned promised persists
103-
* in this cache to shared in similar requests
104-
* before being resolved.
101+
* Cache used to store in-flight requests.
102+
* When a request is marked as `cacheable`, its returned Promise
103+
* is stored in this cache so that identical requests can share
104+
* the same Promise before it resolves.
105+
*
106+
* @warning
107+
* The provided cache **must not** serialize stored values.
108+
*
109+
* Since in-flight requests are stored as Promises (which cannot be
110+
* serialized to JSON), using a serializing cache will cause failures.
111+
*
112+
* Make sure to use a non-serializing cache implementation, such as `createMemoryCache({ serializable: false })` or to disable request caching with `createNullCache()`
105113
*/
106114
requestsCache: Cache;
107115

0 commit comments

Comments
 (0)