-
Notifications
You must be signed in to change notification settings - Fork 21
[CL-875] ADR 0029 - Adopt Angular Signals for Component State #638
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
Merged
+92
โ3
Merged
Changes from 6 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fd54ef3
wip
willmartian ad9582c
more WIP + some AI
willmartian 1061809
add signal adr 28
willmartian 55a0d15
Merge branch 'main' into signals-adr
willmartian 3d6c1b6
further reading; fix typo
willmartian c977fa5
wip
willmartian 7dbf35d
rename to ADR #29
willmartian 3dfc3e4
code review changes
willmartian f5ca87c
fix merge conflict
willmartian d769929
update prettier and run
willmartian c7ac12a
fix spelling
willmartian b796954
clarify guidance; update ADR 0003
willmartian 1173f8a
fix broken link
willmartian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| --- | ||
| adr: "0028" | ||
| status: "Accepted" | ||
| date: 2025-11-24 | ||
| tags: [clients, angular] | ||
| --- | ||
|
|
||
| # 0028 - Adopt Angular Signals for Component State | ||
|
|
||
| <AdrTable frontMatter={frontMatter}></AdrTable> | ||
|
|
||
| ## Context and Problem Statement | ||
|
|
||
| Angular has adopted a new reactive primitive, signals. Signals have various improvements over RxJS: | ||
| performance, simplicity, and deeper integrations into the rest of the framework. | ||
|
|
||
| RxJS will become an optional dependency of Angular. Certain asynchronous workflows will still | ||
| benefit from RxJS--signals are synchronous. Furthermore, being a part of the core Angular library, | ||
| Angular signals cannot readily be used in non-Angular environments. | ||
|
|
||
| As such, Signals should be the default when operating _in the view layer_: components, directives, | ||
| pipes, and services that are tightly coupled to the UI/Angular. Services that primarily deal with | ||
| business logic should prefer RxJS to maximize portability (or, even better, be moved to the Rust | ||
| SDK). | ||
|
|
||
| ## Decision | ||
|
|
||
| Signal-based APIs (inputs, outputs, child queries) will be required in components and directives via | ||
| linting: | ||
|
|
||
| - `@Input()` โ `input()` | ||
| - `@Output()` โ `output()` | ||
| - `@ViewChild`/`@ContentChild` โ `viewChild()`/`contentChild()` | ||
|
|
||
| Services tightly coupled to Angular should use signals. Services with business logic should prefer | ||
| RxJS for portability. Use `toSignal()` and `toObservable()` to bridge between the two when needed. | ||
|
|
||
| Existing code will be migrated gradually. New code must use signal-based APIs. | ||
|
|
||
| ## Consequences | ||
|
|
||
| **Positive:** | ||
|
|
||
| - Improved performance and simpler change detection | ||
| - Clear path to removing Zone.js dependency | ||
| - Better debugging experience | ||
| - Aligned with Angular's direction | ||
| - Simpler than RxJS for many common use cases | ||
|
|
||
| **Negative:** | ||
|
|
||
| - Temporary complexity during migration with mixed RxJS/Signals patterns | ||
| - Learning curve for team members unfamiliar with signals | ||
| - Migration effort required for existing codebase | ||
|
|
||
| ## Reasons against other options | ||
|
|
||
| - Disallow usage of signals and only use RxJS for reactivity. | ||
| - This is a non-starter. Signals are being built into Angular. | ||
| - Continue the status quo of adhoc usage. | ||
willmartian marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Having multiple ways to do the same thing leads to analysis paralysis and complicated code. | ||
| - Signals + OnPush change detection provide a clear path to removing Zone.js. With that comes | ||
| notable performance and debugging improvements. | ||
|
|
||
| ## Further reading | ||
|
|
||
| - [Angular docs](https://angular.dev/guide/signals) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐ญ Consider adding guidance on the migration strategy. Should this happen incrementally per feature area? Are there any teams or components that should be prioritized? ADR 0027 had a detailed "Implementation Plan" section which was helpful.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๐จ I agree that this ADR needs an Implementation Plan section. I do not think that it needs to be overwhelming and could even point to some of the specific sections in the Angular Migrations Wiki
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My suggested approach would be for all teams to run the signal related migrations for all code they own, ideally feature by feature. But if we define a plan we also need to put weight behind it, we have plenty of existing ADRs with implementation plans that are pending.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, yes, the primary intent of a plan in an ADR is the steps by which each team will go through to accomplish the goal. We cannot set the timing of when the plan is done, but it does help to influence the timing when we can approach stakeholders showing a prescriptive plan on how to do the work.