MCPcopy Create free account
hub / github.com/effect-app/libs / observedAtom

Function observedAtom

packages/vue/src/query.ts:448–460  ·  view source on GitHub ↗
(
  atom: Atom.Atom<AsyncResult.AsyncResult<A, E>>,
  options?: {
    readonly staleTime?: number
    readonly gcTime?: number | "infinity"
    readonly idleTTL?: number | "infinity"
    readonly refetchOnWindowFocus?: boolean
    readonly revalidateOnFocus?: boolean
    readonly structuralSharing?: boolean
    readonly refetchInterval?: number
    readonly refreshEvery?: number
  }
)

Source from the content-addressed store, hash-verified

446 atom: () => Atom.Writable<Atom.PullResult<A, E>, void>
447): StreamQueryView<A, E> => {
448 const registry = injectRegistry()
449 const atomRef = computed(atom)
450 const atomResult = useAtomValue(() => atomRef.value)
451 const result = computed(() => atomResult.value)
452 const pull = () => registry.set(atomRef.value, void 0)
453 const refresh = () => registry.refresh(atomRef.value)
454 const awaitResult = () => awaitAtomResult(registry, atomRef.value)
455 const pullAndAwait = () =>
456 Effect.gen(function*() {
457 pull()
458 return yield* awaitResult()
459 })
460 const items = computed(() =>
461 Option.getOrElse(
462 Option.map(AsyncResult.value(result.value), (_) => _.items),
463 () => []

Callers 2

queryAtomForFunction · 0.85
makeQueryViewFunction · 0.85

Calls 2

withQueryOptionsFunction · 0.90
normalizeQueryOptionsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…