Open incepter opened 1 year ago
To support SSR, cache should be serializable, and thus provided by userland, such as a hash function as options;
signature:
Options<T, A extends unknown[], R>: {
// ...
cacheHash: (...args: A) => string;
// ...
}
enabling cache should act on the
Fiber
query propertyif cache is enabled, the query is replaced by a wrapper around the original query, that performs caching around args.
This can be done either by using React.cache or a small abstraction leveraging memoizing function returns based on inputs args identity, or a custom hash function by provided by the user.