Skip to content

fix(compiler-cli): apply debugName transform to required signal queries#69462

Open
P4 wants to merge 1 commit into
angular:mainfrom
P4:required-query-debug-transform
Open

fix(compiler-cli): apply debugName transform to required signal queries#69462
P4 wants to merge 1 commit into
angular:mainfrom
P4:required-query-debug-transform

Conversation

@P4

@P4 P4 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Transform assumed .required functions always take options as the first argument. This is true for input and model, but not for viewChild and contentChild, which take the same arguments as non-required versions.

Change the code to put options for signal queries in the right position, causing debugName to be correctly generated for signal queries.

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?

the transform is only applied for plain versions of signal queries, .required are left without a debugName:

testViewChild = viewChild('p', ...(ngDevMode ? [{ debugName: "testViewChild" }] : /* istanbul ignore next */ []));
testViewChildRequired = viewChild.required('p');
testContentChild = contentChild(Test, ...(ngDevMode ? [{ debugName: "testContentChild" }] : /* istanbul ignore next */ []));
testContentChildRequired = contentChild.required(Test);

The transform tries to do the same thing as for input/model.required, i.e. place the debug name as the first argument. Since the locator argument is not an object literal, the transform does nothing.

What is the new behavior?

required versions are transformed the same way as the plain versions.
changing options position for .required is done only for input and model.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Transform assumed `.required` functions always take options as the first argument.
This is true for `input` and `model`, but not for `viewChild` and `contentChild`,
which take the same arguments as non-required versions.

Change the code to put options for signal queries in the right position,
causing debugName to be correctly generated for signal queries.
@angular-robot angular-robot Bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Jun 22, 2026
@pullapprove pullapprove Bot requested a review from kirjs June 22, 2026 11:22
@ngbot ngbot Bot added this to the Backlog milestone Jun 22, 2026
@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Jun 22, 2026
@JeanMeche JeanMeche removed the request for review from kirjs June 22, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants