angular/packages/core/primitives/signals/src
Rocky Meza 219462fe0f refactor(core): Split consumerBefore/AfterComputation (#62549)
This makes it possible to batch effects, where we can "reopen" consumers
during initial render and then finalize them after we are finally done
adding all the effects to a batch:

```
function createBatch() {
  const effect = // ... create effect node
  resetConsumerBeforeComputation(effect);
  return effect;
}

// pseudo-code
function appendEffect(effectBatch, updater) {
  if (value is a signal) {
    const prevConsumer = setActiveConsumer(effectBatch.node);
    const output = value();
    setActiveConsumer(prevConsumer);
    effectBatch.push({ signal, updater });
    return output;
  }
}

function finalizeBatch(effectBatch) {
  if (effectBatch.length > 0) {
    finalizeConsumerAfterComputation(effectBatch.node);
  }
}

const effectBatch = createBatchEffectNode();
appendEffect(signal1, (newValue) => /* something */);
appendEffect(signal2, (newValue) => /* something different */);
finalizeBatch(effectBatch);
```

PR Close #62549
2025-09-11 15:47:34 +00:00
..
computed.ts refactor(core): drop computation error messages in production (#60700) 2025-05-01 10:11:01 -07:00
effect.ts refactor(core): Create a base effect interface and prototype to be used by both angular and wiz. (#62931) 2025-08-26 14:48:33 -07:00
equality.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
errors.ts feat(core): pass signal node to throwInvalidWriteToSignalErrorFn (#59600) 2025-02-13 17:56:14 +00:00
graph.ts refactor(core): Split consumerBefore/AfterComputation (#62549) 2025-09-11 15:47:34 +00:00
linked_signal.ts refactor: add explicit types for exports relying on inferred call return type (#61312) 2025-05-13 22:45:18 +00:00
signal.ts refactor(core): Delete createSignalTuple (#61907) 2025-06-06 13:46:16 +02:00
untracked.ts refactor: add untracked to primitives (#60105) 2025-03-05 12:11:40 -08:00
watch.ts refactor(core): drop computation error messages in production (#60700) 2025-05-01 10:11:01 -07:00
weak_ref.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00