angular/packages/core/primitives/signals/index.ts
Pawel Kozlowski 20008a6b56 refactor(core): rework runtime implementation to simplify and fix issues (#54103)
This commit changes the approach to the reactive node representing query
results: instead of creating a custom node type we can use a computed -
the main change to get there is representing dirty change notification as
a signal (a counter updated every time a query changes its dirty status).

This change is dictated by simplification (we can avoid creation of a custom
signal type) as well as fixes to the multiple issues not covered by the
initial implementation:
- assuring referential stability of results (ex.: the same array instance
  returned from child queries until results change);
- per-view results collection to avoid a situation where accessing query
  results during view creation would return partial / inconsistent results;
- proper refresh of query results for both live and non-connected consumers.

All the above cases are covered by the additional tests in this commit.

PR Close #54103
2024-02-06 15:04:36 +00:00

16 lines
1 KiB
TypeScript

/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
export {ComputedNode, createComputed} from './src/computed';
export {ValueEqualityFn, defaultEquals} from './src/equality';
export {setThrowInvalidWriteToSignalError} from './src/errors';
export {REACTIVE_NODE, Reactive, ReactiveNode, SIGNAL, consumerAfterComputation, consumerBeforeComputation, consumerDestroy, consumerMarkDirty, consumerPollProducersForChange, getActiveConsumer, isInNotificationPhase, isReactive, producerAccessed, producerNotifyConsumers, producerUpdateValueVersion, producerUpdatesAllowed, setActiveConsumer} from './src/graph';
export {SIGNAL_NODE, SignalGetter, SignalNode, createSignal, setPostSignalSetFn, signalSetFn, signalUpdateFn} from './src/signal';
export {Watch, WatchCleanupFn, WatchCleanupRegisterFn, createWatch} from './src/watch';
export {setAlternateWeakRefImpl} from './src/weak_ref';