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

Function updateComputed

src/index.ts:240–264  ·  view source on GitHub ↗
(c: ComputedNode)

Source from the content-addressed store, hash-verified

238}
239
240function updateComputed(c: ComputedNode): boolean {
241 if (c.flags & HasChildEffect) {
242 let link = c.depsTail;
243 while (link !== undefined) {
244 const prev = link.prevDep;
245 const dep = link.dep;
246 if (!('getter' in dep) && !('currentValue' in dep)) {
247 unlink(link, c);
248 }
249 link = prev;
250 }
251 }
252 c.depsTail = undefined;
253 c.flags = ReactiveFlags.Mutable | ReactiveFlags.RecursedCheck;
254 const prevSub = setActiveSub(c);
255 try {
256 ++cycle;
257 const oldValue = c.value;
258 return oldValue !== (c.value = c.getter(oldValue));
259 } finally {
260 activeSub = prevSub;
261 c.flags &= ~ReactiveFlags.RecursedCheck;
262 purgeDeps(c);
263 }
264}
265
266function updateSignal(s: SignalNode): boolean {
267 s.flags = ReactiveFlags.Mutable;

Callers 2

updateFunction · 0.85
computedOperFunction · 0.85

Calls 3

unlinkFunction · 0.85
setActiveSubFunction · 0.85
purgeDepsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…