Skip to content

feat(core): introduce debugName optional arg to framework signal functions - #57073

Closed
AleksanderBodurri wants to merge 1 commit into
angular:mainfrom
AleksanderBodurri:signal-function-debug-name
Closed

AleksanderBodurri wants to merge 1 commit into
angular:mainfrom
AleksanderBodurri:signal-function-debug-name

Conversation

@AleksanderBodurri

@AleksanderBodurri AleksanderBodurri commented Jul 22, 2024 •

Copy link
Copy Markdown
Member

Blocked by #57710

Angular DevTools is working on developing signal debugging support. This commit is a step in the direction of making available debug information to the framework that will allow Angular DevTools to provide users with more accurate information regarding the usage of signals in their applications.

Follow up PRs that will use this arg will:

  • Develop debug APIs for discovering signal graphs within Angular applications (using debugName as a way to label nodes on the graph) (refactor(core): implement experimental getSignalGraph debug API  #57074)
  • Develop a typescript transform that will detect usages of signal functions and attempt to add a debugName without the user needing to specify one directly.

@pullapprove
pullapprove Bot requested review from alxhub and tbondwilkinson July 22, 2024 04:52
@pullapprove pullapprove Bot added the requires: TGP This PR requires a passing TGP before merging is allowed label Jul 22, 2024
@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: core Issues related to the framework runtime labels Jul 22, 2024
@ngbot ngbot Bot added this to the Backlog milestone Jul 22, 2024
@AleksanderBodurri
AleksanderBodurri force-pushed the signal-function-debug-name branch from 6d94bb9 to ef5240b Compare July 22, 2024 04:55
@pullapprove
pullapprove Bot requested review from alxhub and tbondwilkinson July 22, 2024 06:44
@tbondwilkinson
tbondwilkinson requested review from mturco and removed request for tbondwilkinson July 22, 2024 16:43

@mturco mturco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@dgp1130 dgp1130 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @AleksanderBodurri, this look great! A lot more places to update than I expected. 😅

I just have one question about ngDevMode usage and a few minor nits, but nothing too significant here.

Comment thread packages/core/primitives/signals/src/graph.ts
Comment thread packages/core/src/render3/query_reactive.ts Outdated
Comment thread packages/core/src/render3/reactivity/effect.ts Outdated
Comment thread packages/core/test/signals/signal_spec.ts
* @param options Additional options for the model.
*/
export function createModelSignal<T>(initialValue: T): ModelSignal<T> {
export function createModelSignal<T>(initialValue: T, opts?: ModelOptions): ModelSignal<T> {

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.

ModelOptions's alias isn't used in the function. Should we narrow down the type here ?

@AleksanderBodurri
AleksanderBodurri force-pushed the signal-function-debug-name branch 2 times, most recently from 70c8e84 to 8ce5039 Compare July 29, 2024 16:49

@dgp1130 dgp1130 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@alxhub, can you take a look? Any concerns on your end?

Comment thread packages/core/test/acceptance/authoring/model_inputs_spec.ts Outdated

@alxhub alxhub left a comment

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.

Generally this LGTM. For g3sync reasons you'll need to separate the changes to @angular/core/primitives code into a separate PR, plus there are a few topics to discuss on

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.

Should we not assign this only inngDevMode above? Also, we should conditionally assign only if options?.debugName is defined (otherwise we add an extra property to all nodes of this type, which has a high memory cost).

Comment thread packages/core/src/render3/reactivity/effect.ts Outdated
Comment thread packages/core/src/render3/reactivity/effect.ts Outdated
@AleksanderBodurri
AleksanderBodurri force-pushed the signal-function-debug-name branch 2 times, most recently from e96e1f7 to 3d7835b Compare September 12, 2024 17:11
@pullapprove pullapprove Bot removed the requires: TGP This PR requires a passing TGP before merging is allowed label Sep 12, 2024
@AleksanderBodurri
AleksanderBodurri force-pushed the signal-function-debug-name branch from 53a0a0a to a15259f Compare October 19, 2024 05:19
@angular-robot angular-robot Bot added area: core Issues related to the framework runtime and removed area: core Issues related to the framework runtime labels Oct 19, 2024
…tions

Angular DevTools is working on developing signal debugging support. This commit is a step in the direction of making available debug information to the framework that will allow Angular DevTools to provide users with more accurate information regarding the usage of signals in their applications.

Follow up PRs that will use this arg will:
- Develop a typescript transform that will detect usages of signal functions and attempt to add a debugName without the user needing to specify one directly
- Develop debug APIs for discovering signal graphs within Angular applications (using debugName as a way to label nodes on the graph)
@AleksanderBodurri
AleksanderBodurri force-pushed the signal-function-debug-name branch from a15259f to 48b42ee Compare October 19, 2024 19:00
@angular-robot angular-robot Bot added area: core Issues related to the framework runtime and removed area: core Issues related to the framework runtime labels Oct 19, 2024
@alxhub alxhub added the target: minor This PR is targeted for the next minor release label Oct 21, 2024

@AndrewKushnir AndrewKushnir left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed-for: public-api

@pullapprove
pullapprove Bot requested a review from thePunderWoman October 22, 2024 01:56

@thePunderWoman thePunderWoman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

reviewed-for: public-api

@pkozlowski-opensource
pkozlowski-opensource removed their request for review October 22, 2024 14:24
@dgp1130 dgp1130 added the action: merge The PR is ready for merge by the caretaker label Oct 22, 2024
@ngbot

ngbot Bot commented Oct 22, 2024

Copy link
Copy Markdown

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "google-internal-tests" is failing
    pending status "mergeability" is pending
    pending 1 pending code review

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken main, please try rebasing to main and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@alxhub alxhub added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Oct 22, 2024
@alxhub

alxhub commented Oct 22, 2024

Copy link
Copy Markdown
Member

Caretaker: this is "green" in g3.

@AndrewKushnir

Copy link
Copy Markdown
Contributor

This PR was merged into the repository by commit ec386e7.

The changes were merged into the following branches: main

@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Nov 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime detected: feature PR contains a feature commit merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants