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

Function seed

packages/effect/src/ui/Query.ts:7301–7321  ·  view source on GitHub ↗
(snapshot)

Source from the content-addressed store, hash-verified

7299 return out
7300 }
7301 const seed: CacheInternals["seed"] = (snapshot) => {
7302 const data = snapshotData(snapshot)
7303 // A per-request cache never refetches a settled entry, so a seed there would be final.
7304 if (disposed || settleOnce || data === undefined) return false
7305 // Never from a value that may never have been saved.
7306 if (
7307 data.patched || data.argsKey === undefined ||
7308 data.result?._tag !== "Success"
7309 ) return false
7310 const def = register(data.def)
7311 const existing = lookup(def, data.argsKey)
7312 if (existing?.result !== undefined) return false
7313 const entry = existing ?? ensureEntry(def, data.args, data.argsKey)
7314 entry.result = AsyncResult.success(data.result.value, {
7315 timestamp: data.result.timestamp
7316 })
7317 entry.settledAt = now()
7318 entry.invalidated = true
7319 afterQuiet(entry)
7320 return true
7321 }
7322
7323 // -- host signals -----------------------------------------------------------
7324 /** One synchronous pass over watched entries, on a false-to-true edge with both signals then true. */

Callers

nothing calls this directly

Calls 6

snapshotDataFunction · 0.85
ensureEntryFunction · 0.85
afterQuietFunction · 0.85
registerFunction · 0.70
lookupFunction · 0.70
nowFunction · 0.70

Tested by

no test coverage detected