(
arr: I | WatchSource<I> | undefined | WatchSource<Option.Option<I>>,
options?: { readonly mode?: "optional"; readonly enabled?: MaybeRefOrGetter<boolean | undefined> }
)
| 416 | ] as const, |
| 417 | { |
| 418 | ...view, |
| 419 | data |
| 420 | } |
| 421 | ) |
| 422 | }) |
| 423 | |
| 424 | return Effect.runPromise(eff, { signal }) |
| 425 | } |
| 426 | |
| 427 | export type StreamQueryPullValue<A> = { |
| 428 | readonly done: boolean |
| 429 | readonly items: ReadonlyArray<A> |
| 430 | } |
| 431 | |
| 432 | export interface StreamQueryView<A, E> { |
| 433 | readonly result: ComputedRef<Atom.PullResult<A, E>> |
| 434 | readonly items: ComputedRef<ReadonlyArray<A>> |
| 435 | readonly latest: ComputedRef<A | undefined> |
| 436 | readonly done: ComputedRef<boolean> |
| 437 | readonly awaitResult: () => Effect.Effect<StreamQueryPullValue<A>, E | Cause.NoSuchElementError, never> |
| 438 | readonly pull: () => void |
| 439 | readonly pullAndAwait: () => Effect.Effect<StreamQueryPullValue<A>, E | Cause.NoSuchElementError, never> |
| 440 | readonly refresh: () => void |
| 441 | readonly registry: ReturnType<typeof injectRegistry> |
| 442 | readonly atom: ComputedRef<Atom.Writable<Atom.PullResult<A, E>, void>> |
| 443 | } |
| 444 | |
| 445 | export const useAtomStreamQuery = <A, E>( |
| 446 | atom: () => Atom.Writable<Atom.PullResult<A, E>, void> |
| 447 | ): StreamQueryView<A, E> => { |
| 448 | const registry = injectRegistry() |
| 449 | const atomRef = computed(atom) |
no test coverage detected
searching dependent graphs…