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

Function emit

packages/effect/src/ui/Query.ts:5603–5634  ·  view source on GitHub ↗
(entry: Entry)

Source from the content-addressed store, hash-verified

5601 }
5602 /** Quiet over a cold entry, and skips a state equal to a watcher's last. */
5603 const emit = (entry: Entry): void => {
5604 if (entry.watchers.size === 0) return
5605 const server = view(entry)
5606 if (server._tag === "Initial") return
5607 const more = moreOf(entry)
5608 let patchedView: PatchedView | undefined
5609 for (const watcher of Array.from(entry.watchers)) {
5610 if (!watcher.active) continue
5611 if (watcher.provisional !== undefined) {
5612 // The withheld Failure, waiting or not: still withheld.
5613 if (watcher.provisional === entry.result) continue
5614 watcher.provisional = undefined
5615 }
5616 let result: AsyncResult.AsyncResult<any, any> = server
5617 let patched = false
5618 if (watcher.patched) {
5619 patchedView ??= patchedViewOf(entry, server)
5620 result = patchedView.result
5621 patched = patchedView.patched
5622 }
5623 if (
5624 patched === watcher.lastPatched && sameMore(more, watcher.lastMore) &&
5625 queryCore.sameResult(result, watcher.last)
5626 ) {
5627 continue
5628 }
5629 watcher.last = result
5630 watcher.lastPatched = patched
5631 watcher.lastMore = more
5632 watcher.onChange(result as Settled, patched, more)
5633 }
5634 }
5635 const emitFetch = (
5636 entry: Entry,
5637 trigger: Trigger,

Callers 11

startFetchFunction · 0.70
afterFetchFunction · 0.70
revertFunction · 0.70
holdFunction · 0.70
settleRunEntryFunction · 0.70
storeWriteFunction · 0.70
beginRunFunction · 0.70
closeWindowFunction · 0.70
deliverFunction · 0.70
connectFunction · 0.70
sendLatestFunction · 0.50

Calls 5

patchedViewOfFunction · 0.85
sameMoreFunction · 0.85
fromMethod · 0.80
viewFunction · 0.70
moreOfFunction · 0.70

Tested by

no test coverage detected