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

Function invalidateEntry

packages/effect/src/ui/Query.ts:6607–6639  ·  view source on GitHub ↗
(
    entry: Entry,
    cause: Trigger = "invalidation",
    parent?: queryCore.SpanContext | undefined
  )

Source from the content-addressed store, hash-verified

6605 return out
6606 }
6607 const invalidateEntry = (
6608 entry: Entry,
6609 cause: Trigger = "invalidation",
6610 parent?: queryCore.SpanContext | undefined
6611 ): void => {
6612 entry.touched = ++seq
6613 // A never-fetched entry is a no-op.
6614 if (entry.result === undefined && entry.fetch === undefined) return
6615 if (entry.result !== undefined) entry.invalidated = true
6616 // Under a live patch the refetch waits for the last live owner.
6617 if (hasLive(entry)) {
6618 holdBack(entry, cause, undefined)
6619 entry.deferredParent = parent
6620 return
6621 }
6622 const deferred = entry.deferred
6623 const trigger = deferred ?? cause
6624 const deferredWatcher = deferred === undefined ? undefined : entry.deferredWatcher
6625 entry.deferred = undefined
6626 entry.deferredParent = undefined
6627 entry.deferredWatcher = undefined
6628 if (entry.live !== undefined) dropFetch(entry)
6629 // In flight: interrupted and restarted, watched or not.
6630 if (entry.fetch !== undefined) {
6631 return replaceFetch(entry, entry.fetch, parent)
6632 }
6633 if (entry.watchers.size > 0 || entry.waiters.size > 0) {
6634 const build = survivingBuild(entry)
6635 if (build !== undefined) {
6636 ensureFetch(entry, trigger, build, parent, deferredWatcher)
6637 }
6638 }
6639 }
6640 const invalidate: CacheInternals["invalidate"] = (
6641 targets,
6642 invalidateOptions

Callers 3

ensureEntryFunction · 0.70
invalidateFunction · 0.70
beginRunFunction · 0.70

Calls 6

hasLiveFunction · 0.85
holdBackFunction · 0.85
dropFetchFunction · 0.85
replaceFetchFunction · 0.85
survivingBuildFunction · 0.85
ensureFetchFunction · 0.85

Tested by

no test coverage detected