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

Function invalidate

packages/effect/src/ui/Query.ts:6640–6669  ·  view source on GitHub ↗
(
    targets,
    invalidateOptions
  )

Source from the content-addressed store, hash-verified

6638 }
6639 }
6640 const invalidate: CacheInternals["invalidate"] = (
6641 targets,
6642 invalidateOptions
6643 ) => {
6644 if (disposed) return
6645 registerTargets(targets)
6646 if (settleOnce) {
6647 if (invalidateOptions?.byHand === true) {
6648 const named = targets.find((target) => isQuery(target) || target._tag === "Entry")
6649 const query = named === undefined
6650 ? undefined
6651 : isQuery(named)
6652 ? defOf(named).name
6653 : defOf((named as EntryTarget).query).name
6654 report(
6655 new InvalidateIgnored({
6656 query,
6657 message: "[Query] invalidate" +
6658 (query === undefined ? "" : " of " + quote(query)) +
6659 " was called on a per-request server cache, where it does nothing."
6660 })
6661 )
6662 }
6663 return
6664 }
6665 const parent = invalidateOptions?.parent
6666 for (const entry of resolve(compileTargets(targets))) {
6667 invalidateEntry(entry, "invalidation", parent)
6668 }
6669 }
6670
6671 // -- runs, patches and writes -----------------------------------------------
6672 /** The check made when a run's patches stop being live on an entry: a refetch that was held back. */

Callers

nothing calls this directly

Calls 9

registerTargetsFunction · 0.85
defOfFunction · 0.85
compileTargetsFunction · 0.85
isQueryFunction · 0.70
reportFunction · 0.70
quoteFunction · 0.70
resolveFunction · 0.70
invalidateEntryFunction · 0.70
findMethod · 0.65

Tested by

no test coverage detected