(
input: unknown,
output: Exit.Exit<unknown, unknown>
)
| 271 | return tuple(computed(() => state.value), act) |
| 272 | } |
| 273 | |
| 274 | const buildInvalidateCache = <RInvalidator>( |
| 275 | self: { id: string; options?: ClientForOptions; disableQueryInvalidation?: boolean }, |
| 276 | queryInvalidation: MutationOptionsBase["queryInvalidation"] | undefined, |
| 277 | queryInvalidator: QueryInvalidator<RInvalidator> |
| 278 | ) => { |
| 279 | // Concrete reactivity keys to invalidate: a raw query key, one derived from an `{ id }` |
| 280 | // entry, or a compatibility `{ filters: { queryKey } }` entry. |
| 281 | // Predicate-only `{ filters }` entries have no exact-key reactivity equivalent and throw. |
| 282 | const getClientInvalidationKeys = ( |
| 283 | input: unknown, |
| 284 | output: Exit.Exit<unknown, unknown> |
| 285 | ): ReadonlyArray<ReadonlyArray<unknown>> => { |
| 286 | const queryKey = getQueryKey(self) |
| 287 | |
| 288 | if (queryInvalidation) { |
| 289 | const keys: Array<ReadonlyArray<unknown>> = [] |
| 290 | for (const entry of queryInvalidation(queryKey, self.id, input, output)) { |
| 291 | if (isQueryKey(entry)) { |
| 292 | keys.push(entry) |
| 293 | continue |
| 294 | } |
| 295 | if ("id" in entry) { |
| 296 | keys.push(makeQueryKey(entry.options ? { id: entry.id, options: entry.options } : { id: entry.id })) |
| 297 | continue |
| 298 | } |
| 299 | const filterQueryKey = queryKeyFromFilters(entry) |
| 300 | if (filterQueryKey !== undefined) { |
| 301 | keys.push(filterQueryKey) |
| 302 | continue |
| 303 | } |
| 304 | throw new Error("Unsupported query invalidation filter: only filters.queryKey is supported") |
| 305 | } |
| 306 | return keys |
| 307 | } |
no test coverage detected
searching dependent graphs…