Content-Length: 333501 | pFad | http://github.com/angular/angular/pull/60700/files

D3 refactor(core): drop computation error messages in production by arturovt · Pull Request #60700 · angular/angular · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): drop computation error messages in production #60700

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
4 changes: 3 additions & 1 deletion packages/core/primitives/signals/src/computed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ const COMPUTED_NODE = /* @__PURE__ */ (() => {
producerRecomputeValue(node: ComputedNode<unknown>): void {
if (node.value === COMPUTING) {
// Our computation somehow led to a cyclic read of itself.
throw new Error('Detected cycle in computations.');
throw new Error(
typeof ngDevMode !== 'undefined' && ngDevMode ? 'Detected cycle in computations.' : '',
);
}

const oldValue = node.value;
Expand Down
4 changes: 3 additions & 1 deletion packages/core/primitives/signals/src/linked_signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ export const LINKED_SIGNAL_NODE = /* @__PURE__ */ (() => {
producerRecomputeValue(node: LinkedSignalNode<unknown, unknown>): void {
if (node.value === COMPUTING) {
// Our computation somehow led to a cyclic read of itself.
throw new Error('Detected cycle in computations.');
throw new Error(
typeof ngDevMode !== 'undefined' && ngDevMode ? 'Detected cycle in computations.' : '',
);
}

const oldValue = node.value;
Expand Down
10 changes: 9 additions & 1 deletion packages/core/primitives/signals/src/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import {
SIGNAL,
} from './graph';

// 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;

/**
* A cleanup function that can be optionally registered from the watch logic. If registered, the
* cleanup logic runs before the next watch execution.
Expand Down Expand Up @@ -99,7 +103,11 @@ export function createWatch(
}

if (isInNotificationPhase()) {
throw new Error(`Schedulers cannot synchronously execute watches while scheduling.`);
throw new Error(
typeof ngDevMode !== 'undefined' && ngDevMode
? 'Schedulers cannot synchronously execute watches while scheduling.'
: '',
);
}

node.dirty = false;
Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/angular/angular/pull/60700/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy