MCPcopy
hub / github.com/angular/angular / producerAddLiveConsumer

Function producerAddLiveConsumer

packages/core/primitives/signals/src/graph.ts:523–544  ·  view source on GitHub ↗

* Add `consumer` as a live consumer of this node. * * Note that this operation is potentially transitive. If this node becomes live, then it becomes * a live consumer of all of its current producers.

(node: ReactiveNode, link: ReactiveLink)

Source from the content-addressed store, hash-verified

521 * a live consumer of all of its current producers.
522 */
523function producerAddLiveConsumer(node: ReactiveNode, link: ReactiveLink): void {
524 const consumersTail = node.consumersTail;
525 const wasLive = consumerIsLive(node);
526 if (consumersTail !== undefined) {
527 link.nextConsumer = consumersTail.nextConsumer;
528 consumersTail.nextConsumer = link;
529 } else {
530 link.nextConsumer = undefined;
531 node.consumers = link;
532 }
533 link.prevConsumer = consumersTail;
534 node.consumersTail = link;
535 if (!wasLive) {
536 for (
537 let link: ReactiveLink | undefined = node.producers;
538 link !== undefined;
539 link = link.nextProducer
540 ) {
541 producerAddLiveConsumer(link.producer, link);
542 }
543 }
544}
545
546function producerRemoveLiveConsumerLink(link: ReactiveLink): ReactiveLink | undefined {
547 const producer = link.producer;

Callers 1

producerAccessedFunction · 0.85

Calls 1

consumerIsLiveFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…