(
getAtomRt: () => AtomClientRuntime,
q: QueryFamilyDescriptor<I, A, E>,
arg: I | WatchSource<I> | undefined | WatchSource<Option.Option<I>>,
options?: (AtomQueryNewOptions<A, TData> | CustomUseQueryOptions<A, E, TData>) & {
readonly mode?: "optional"
}
)
| 483 | registry, |
| 484 | atom: atomRef |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | const optionValue = <I>( |
| 489 | arr: I | WatchSource<I> | undefined | WatchSource<Option.Option<I>>, |
| 490 | options?: { readonly mode?: "optional"; readonly enabled?: MaybeRefOrGetter<boolean | undefined> } |
| 491 | ): readonly [{ readonly value: I }, ComputedRef<boolean>] => { |
| 492 | if (options?.mode === "optional") { |
| 493 | const getOption: () => Option.Option<I> = typeof arr === "function" |
| 494 | ? arr as () => Option.Option<I> |
| 495 | : () => (arr as { value: Option.Option<I> }).value |
| 496 | return [ |
| 497 | { |
| 498 | get value() { |
| 499 | return Option.getOrUndefined(getOption()) as I |
| 500 | } |
| 501 | }, |
| 502 | computed(() => Option.isSome(getOption())) |
| 503 | ] as const |
| 504 | } |
| 505 | const req = !arr |
| 506 | ? ({ value: undefined as I }) |
| 507 | : typeof arr === "function" |
| 508 | ? ({ |
| 509 | get value() { |
| 510 | return (arr as any)() |
| 511 | } |
| 512 | }) |
| 513 | : (ref(arr) as any) |
| 514 | const enabled = options?.enabled |
| 515 | return [req, computed(() => enabled === undefined ? true : !!toValue(enabled))] as const |
| 516 | } |
| 517 | |
| 518 | const observedAtom = <A, E>( |
| 519 | atom: Atom.Atom<AsyncResult.AsyncResult<A, E>>, |
| 520 | options?: { |
| 521 | readonly staleTime?: number |
| 522 | readonly gcTime?: number | "infinity" |
| 523 | readonly idleTTL?: number | "infinity" |
| 524 | readonly refetchOnWindowFocus?: boolean |
| 525 | readonly revalidateOnFocus?: boolean |
| 526 | readonly structuralSharing?: boolean |
| 527 | readonly refetchInterval?: number |
| 528 | readonly refreshEvery?: number |
| 529 | readonly live?: boolean | LiveQueryOptions |
| 530 | readonly invalidation?: QueryInvalidationMode |
| 531 | } |
| 532 | ): Atom.Atom<AsyncResult.AsyncResult<A, E>> => |
no test coverage detected
searching dependent graphs…