Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions packages/signal-polyfill/src/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/

// Required as the signals library is in a separate package, so we need to explicitly ensure the
// global `ngDevMode` type is defined.
declare const ngDevMode: boolean|undefined;


/**
* The currently active consumer `ReactiveNode`, if running code in a reactive context.
Expand Down Expand Up @@ -214,10 +210,7 @@ interface ProducerNode extends ReactiveNode {
*/
export function producerAccessed(node: ReactiveNode): void {
if (inNotificationPhase) {
throw new Error(
typeof ngDevMode !== 'undefined' && ngDevMode ?
`Assertion error: signal read during notification phase` :
'');
throw new Error('Assertion error: signal read during notification phase');
}

if (activeConsumer === null) {
Expand Down Expand Up @@ -462,7 +455,7 @@ export function producerRemoveLiveConsumerAtIndex(node: ReactiveNode, idx: numbe
assertProducerNode(node);
assertConsumerNode(node);

if (typeof ngDevMode !== 'undefined' && ngDevMode && idx >= node.liveConsumerNode.length) {
if (idx >= node.liveConsumerNode.length) {
throw new Error(`Assertion error: active consumer index ${idx} is out of bounds of ${
node.liveConsumerNode.length} consumers)`);
}
Expand Down Expand Up @@ -511,4 +504,4 @@ export function assertConsumerNode(node: ReactiveNode): asserts node is Consumer
export function assertProducerNode(node: ReactiveNode): asserts node is ProducerNode {
node.liveConsumerNode ??= [];
node.liveConsumerIndexOfThis ??= [];
}
}
4 changes: 0 additions & 4 deletions packages/signal-polyfill/src/signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import {defaultEquals, ValueEqualityFn} from './equality.js';
import {throwInvalidWriteToSignalError} from './errors.js';
import {producerAccessed, producerIncrementEpoch, producerNotifyConsumers, producerUpdatesAllowed, REACTIVE_NODE, ReactiveNode, SIGNAL} from './graph.js';

// Required as the signals library is in a separate package, so we need to explicitly ensure the
// global `ngDevMode` type is defined.
declare const ngDevMode: boolean|undefined;

/**
* If set, called after `WritableSignal`s are updated.
*
Expand Down
1 change: 0 additions & 1 deletion packages/signal-polyfill/src/wrapper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1048,5 +1048,4 @@ describe("currentComputed", () => {
// - The code for the callbacks (for reading signals and running watches)
// - Paths around writes being prohibited during computed/effect
// - Setters for various hooks
// - ngDevMode
// - Some predicates/getters for convenience, e.g., isReactive