8000 Better support for going zoneless + signal migration · Issue #61291 · angular/angular · GitHub
[go: up one dir, main page]

Skip to content

Better support for going zoneless + signal migration #61291

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

Open
1 of 2 tasks
jpike88 opened this issue May 13, 2025 · 6 comments
Open
1 of 2 tasks

Better support for going zoneless + signal migration #61291

jpike88 opened this issue May 13, 2025 · 6 comments
Labels
area: docs Related to the documentation core: zoneless Issues related to running Angular without zone.js
Milestone

Comments

@jpike88
Copy link
jpike88 commented May 13, 2025

Is this a bug report or a feature request?

  • Bug Report
  • Feature Request

Please provide the steps to reproduce the issue [Bug Report only]

I assume that the angular team at some point wants devs to go zoneless, and to move angular from rxjs to signals?

The migration tools than are not enough to realistically achieve this.

After running existing migrations, I am left with many components that reference an internal value in a template (e.g a simple boolean property). But because it's zoneless, the value should be converted to a signal. Migration doesn't seem to support this, nor do I get any warnings.

So to convert the project across, I would have to stumble into broken functionality instead of get a global understand of what needs to be changed.

What is the recommendation around this?

Please provide the expected behavior vs the actual behavior you encountered [Bug Report only]

No response

Please provide a screenshot if possible [Bug Report only]

No response

Please provide the exception or error you saw [Bug Report only]


Is this a browser-specific issue? If so, please specify the device, browser, and version. [Bug Report only]


Description [Feature Request only]

No response

Proposed solution [Feature Request only]

No response

Alternatives considered [Feature Request only]

No response

@e-oz
Copy link
e-oz commented May 13, 2025

What migration?

@jpike88
Copy link
Author
jpike88 commented May 13, 2025

I'm referring to the existing ones, how they're not really enough when going zoneless + signals. Zoneless maybe needs its own migration or warning, but considering that it would involve making the @input values into signals instead of primitives... I need some idea of how I'm expected to work with this

Image

@spock123
Copy link
spock123 commented May 13, 2025

@jpike88 You could start by making your application use changeDetection: OnPush everywhere. Once you do this, zoneless will be a simple thing to enable.

I don't think it would be possible to make a migration tool in this case, sounds more like an application design issue to me. Don't ever refer to simple component properties from the template, if you expect those properties to be able to change. Use observables (onPush) or signals.

I really have a hard time imagining how such a migration tool would work, sadly.

@jpike88
Copy link
Author
jpike88 commented May 13, 2025

"Don't ever refer to simple component properties from the template, if you expect those properties to be able to change"

Can some kind of warning tool be used (at least scoped to the component-level implementation) here to help flag components with the problem to help me anticipate breakage better?

  • is the simply property reference in the component
  • is it mutated at all or re-set in the component

We've done things that way in many components... I never even deemed it to be an anti-pattern until now.

@e-oz
Copy link
e-oz commented May 13, 2025

We've done things that way in many components...

Don't try to make this app zoneless for now.
Create new components with the "OnPush" strategy (as long as they don't use any components with the default strategy inside - otherwise, change detection won't work as expected).
When you have no other tasks, start converting existing components (from smallest to larger) to OnPush.
Tests will help with this.
If you try to change everything at once, bugs are unavoidable.

When your entire app is using OnPush, it will be time to try going zoneless.

@JeanMeche
Copy link
Member

It is expect that migrating to zoneless isn't straight forward.

Transitionning one by one components to OnPush is a good way into the direction of moving your app to zoneless.

@JeanMeche JeanMeche added area: docs Related to the documentation core: zoneless Issues related to running Angular without zone.js labels May 14, 2025
@ngbot ngbot bot modified the milestone: needsTriage May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs Related to the documentation core: zoneless Issues related to running Angular without zone.js
Projects
None yet
Development

No branches or pull requests

4 participants
0