MCPcopy Create free account
hub / github.com/Effect-TS/effect / afterFetch

Function afterFetch

packages/effect/src/ui/Query.ts:6029–6042  ·  view source on GitHub ↗
(
    entry: Entry,
    stored: boolean,
    defect: Cause.Cause<never> | undefined
  )

Source from the content-addressed store, hash-verified

6027 }
6028 /** What ends every fetch, after its result is in: the defect and the emission, then the timers. */
6029 const afterFetch = (
6030 entry: Entry,
6031 stored: boolean,
6032 defect: Cause.Cause<never> | undefined
6033 ): void => {
6034 if (defect !== undefined) {
6035 for (const watcher of Array.from(entry.watchers)) {
6036 if (watcher.active) watcher.onDefect?.(defect)
6037 }
6038 }
6039 emit(entry)
6040 if (!stored) rearmInterval(entry)
6041 afterQuiet(entry)
6042 }
6043 /**
6044 * A fetch ended with nothing to store and nothing to restart it: the entry keeps its previous state, its
6045 * freshness included. Only a defect marks the previous Success stale.

Callers 1

onFetchExitFunction · 0.85

Calls 4

rearmIntervalFunction · 0.85
afterQuietFunction · 0.85
fromMethod · 0.80
emitFunction · 0.70

Tested by

no test coverage detected