Skip to content

fix(compiler-cli): include toSignal in debugName transform#69461

Open
P4 wants to merge 2 commits into
angular:mainfrom
P4:toSignal-debug-transform
Open

fix(compiler-cli): include toSignal in debugName transform#69461
P4 wants to merge 2 commits into
angular:mainfrom
P4:toSignal-debug-transform

Conversation

@P4

@P4 P4 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

the toSignal function received a debugName option in 0812ac3, but was not covered by the signalMetadataTransform which sets the debugName in dev mode automatically.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

when running under ng serve, toSignal does not have the debugName set automatically like the other functions (signal, computed, httpResource, etc.)

What is the new behavior?

toSignal gets the same treatment as other functions with debugName:

test = toSignal(of(0));

is transformed into

test = toSignal(of(0), ...(ngDevMode ? [{ debugName: "test" }] : /* istanbul ignore next */ []));

which adds a debugName in dev mode, and gets optimized away in prod mode.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

the toSignal function received a debugName option in 0812ac3,
but was not covered by the signalMetadataTransform which sets the debugName in dev mode
automatically.
@pullapprove pullapprove Bot requested a review from crisbeto June 22, 2026 08:24
@angular-robot angular-robot Bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Jun 22, 2026
@ngbot ngbot Bot added this to the Backlog milestone Jun 22, 2026
@JeanMeche JeanMeche removed the request for review from crisbeto June 22, 2026 08:33
import {of} from 'rxjs';
declare function toSignal(source: any): any;

@Component({

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Several tests a missing an import for Component.

@P4 P4 Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

my bad, these tests originally used toSignal in a variable declaration, I rewrote them last minute because that code wouldn't work at runtime (toSignal needs injection context), even though it compiles and gets transformed correctly

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

Labels

area: compiler Issues related to `ngc`, Angular's template compiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants