MCPcopy Index your code
hub / github.com/coder/coder / cachedQuery

Function cachedQuery

site/src/api/queries/util.ts:43–74  ·  view source on GitHub ↗
(
	options: UseQueryOptionsWithMetadata<
		TMetadata,
		TQueryFnData,
		TError,
		TData,
		TQueryKey
	>,
)

Source from the content-addressed store, hash-verified

41 * buildinfo, and a few others to reduce page load time.
42 */
43export function cachedQuery<
44 TMetadata extends MetadataValue = MetadataValue,
45 TQueryFnData = unknown,
46 TError = unknown,
47 TData = TQueryFnData,
48 TQueryKey extends QueryKey = QueryKey,
49>(
50 options: UseQueryOptionsWithMetadata<
51 TMetadata,
52 TQueryFnData,
53 TError,
54 TData,
55 TQueryKey
56 >,
57): FormattedQueryOptionsResult<TQueryFnData, TError, TData, TQueryKey> {
58 const { metadata, ...delegatedOptions } = options;
59 const newOptions = {
60 ...delegatedOptions,
61 initialData: metadata.available ? metadata.value : undefined,
62
63 // Make sure the disabled options are always serialized last, so that no
64 // one using this function can accidentally override the values
65 ...(metadata.available ? disabledRefetchOptions : {}),
66 };
67
68 return newOptions as FormattedQueryOptionsResult<
69 TQueryFnData,
70 TError,
71 TData,
72 TQueryKey
73 >;
74}

Callers 9

entitlementsFunction · 0.90
meFunction · 0.90
hasFirstUserFunction · 0.90
appearanceSettingsFunction · 0.90
appearanceFunction · 0.90
experimentsFunction · 0.90
organizationsFunction · 0.90
buildInfoFunction · 0.90
ProxyProviderFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected