UNPKG

@apollo/client

Version:

A fully-featured caching GraphQL client.

22 lines (21 loc) 953 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.bindCacheKey = bindCacheKey; const optimism_1 = require("optimism"); /** * A variant of `optimism`'s `defaultMakeCacheKey` function that allows us to * pre-bind some arguments to be part of the cache key Trie path. * * This should always be used in place of `defaultMakeCacheKey` to bind * the `this` context of classes owning wrapped functions, to ensure that * the cache keys are collected from memory when the owning object is garbage collected. * * Without this, cache keys can stay in memory indefinitely, even though the owning * Apollo Client instance is long gone. * This is a risk in long-running processes with `[DocumentNode, string, string]` * style cache keys with persistent document nodes. */ function bindCacheKey(...prebound) { return optimism_1.defaultMakeCacheKey.bind(null, ...prebound); } //# sourceMappingURL=bindCacheKey.cjs.map