MCPcopy Index your code
hub / github.com/TanStack/db / generateQueryKeyFromOptions

Function generateQueryKeyFromOptions

packages/query-db-collection/src/query.ts:1049–1062  ·  view source on GitHub ↗
(opts: LoadSubsetOptions)

Source from the content-addressed store, hash-verified

1047 * Inconsistent keys would cause refcount leaks and prevent proper cleanup.
1048 */
1049 const generateQueryKeyFromOptions = (opts: LoadSubsetOptions): QueryKey => {
1050 if (typeof queryKey === `function`) {
1051 // Function-based queryKey: use it to build the key from opts
1052 return queryKey(opts)
1053 } else if (syncMode === `on-demand`) {
1054 // Static queryKey in on-demand mode: automatically append serialized predicates
1055 // to create separate cache entries for different predicate combinations
1056 const serialized = serializeLoadSubsetOptions(opts)
1057 return serialized !== undefined ? [...queryKey, serialized] : queryKey
1058 } else {
1059 // Static queryKey in eager mode: use as-is
1060 return queryKey
1061 }
1062 }
1063
1064 const startupRetentionEntries = metadata?.collection.list(
1065 QUERY_COLLECTION_GC_PREFIX,

Callers 2

createQueryFromOptsFunction · 0.85
unloadSubsetFunction · 0.85

Calls 2

queryKeyFunction · 0.85

Tested by

no test coverage detected