X Tutup
Skip to content

fix(core): include signal debug names in their toString() represent…#67511

Open
JoostK wants to merge 1 commit intoangular:mainfrom
JoostK:signals/toString-debug-name
Open

fix(core): include signal debug names in their toString() represent…#67511
JoostK wants to merge 1 commit intoangular:mainfrom
JoostK:signals/toString-debug-name

Conversation

@JoostK
Copy link
Member

@JoostK JoostK commented Mar 8, 2026

…ation

The toString() implementations in the primitives package intended to include the debug name, yet the debug name was evaluated during construction before it could ever have been assigned. This commit fixes that.

The Angular wrappers override the toString() representation to evaluate signals ad-hoc instead of showing their internal state, and this commit aligns their behavior to include the debug name in toString as well.

…ation

The `toString()` implementations in the primitives package intended to include
the debug name, yet the debug name was evaluated during construction before it
could ever have been assigned. This commit fixes that.

The Angular wrappers override the `toString()` representation to evaluate signals
ad-hoc instead of showing their internal state, and this commit aligns their
behavior to include the debug name in `toString` as well.
@JoostK JoostK added the target: patch This PR is targeted for the next patch release label Mar 8, 2026
@angular-robot angular-robot bot added area: core Issues related to the framework runtime requires: TGP This PR requires a passing TGP before merging is allowed labels Mar 8, 2026
@ngbot ngbot bot added this to the Backlog milestone Mar 8, 2026
if (typeof ngDevMode !== 'undefined' && ngDevMode) {
const debugName = options?.debugName;
node.debugName = debugName;
signalFn.toString = () => `[Signal${debugName ? ' (' + debugName + ')' : ''}: ${signalFn()}]`;
Copy link
Member Author

@JoostK JoostK Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wouldn't necessarily have to override toString cause it outputs the same, but I noticed an interesting difference that is likely unintentional: the primitives toString impls are non-reactive yet the Angular wrappers are reactive.

I think it would make sense to align their behavior, but which behavior to use??

@rahatarmanahmed rahatarmanahmed requested review from mturco and removed request for rahatarmanahmed March 9, 2026 14:45
Copy link
Contributor

@mturco mturco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer-for: primitives-shared

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Issues related to the framework runtime requires: TGP This PR requires a passing TGP before merging is allowed target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

X Tutup