angular/packages/core/primitives
Rocky Meza 663f48cfc1 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:33 +00:00
..
defer build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
di build: rename defaults2.bzl to defaults.bzl (#63383) 2025-08-25 15:45:01 -07:00
dom-navigation refactor(core): Reorder resolve/reject in relation to navigate[error/success] (#63377) 2025-08-27 11:16:53 -07:00
event-dispatch refactor(bazel): reduce build deps (#63348) 2025-08-28 09:16:10 -07:00
signals refactor(core): Split consumerBefore/AfterComputation (#62549) 2025-09-11 15:47:33 +00:00