MCPcopy
hub / github.com/stackblitz/alien-signals / computedOper

Function computedOper

src/index.ts:333–366  ·  view source on GitHub ↗
(this: ComputedNode<T>)

Source from the content-addressed store, hash-verified

331}
332
333function computedOper<T>(this: ComputedNode<T>): T {
334 const flags = this.flags;
335 if (
336 flags & ReactiveFlags.Dirty
337 || (
338 flags & ReactiveFlags.Pending
339 && (
340 checkDirty(this.deps!, this)
341 || (this.flags = flags & ~ReactiveFlags.Pending, false)
342 )
343 )
344 ) {
345 if (updateComputed(this)) {
346 const subs = this.subs;
347 if (subs !== undefined) {
348 shallowPropagate(subs);
349 }
350 }
351 } else if (!flags) {
352 this.flags = ReactiveFlags.Mutable | ReactiveFlags.RecursedCheck;
353 const prevSub = setActiveSub(this);
354 try {
355 this.value = this.getter();
356 } finally {
357 activeSub = prevSub;
358 this.flags &= ~ReactiveFlags.RecursedCheck;
359 }
360 }
361 const sub = activeSub;
362 if (sub !== undefined) {
363 link(this, sub, cycle);
364 }
365 return this.value!;
366}
367
368function signalOper<T>(this: SignalNode<T>, ...value: [T]): T | void {
369 if (value.length) {

Callers

nothing calls this directly

Calls 5

checkDirtyFunction · 0.85
updateComputedFunction · 0.85
shallowPropagateFunction · 0.85
setActiveSubFunction · 0.85
linkFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…