Skip to content

Commit 3dfc3e4

Browse files
committed
code review changes
1 parent 7dbf35d commit 3dfc3e4

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

docs/architecture/adr/0029-angular-signals.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Angular has adopted a new reactive primitive, signals. Signals have various impr
1515
performance, simplicity, and deeper integrations into the rest of the framework.
1616

1717
RxJS will become an optional dependency of Angular. Certain asynchronous workflows will still
18-
benefit from RxJS--signals are synchronous. Furthermore, being a part of the core Angular library,
18+
benefit from RxJS (signals are synchronous). Furthermore, being a part of the core Angular library,
1919
Angular signals cannot readily be used in non-Angular environments.
2020

2121
As such, Signals should be the default when operating _in the view layer_: components, directives,
@@ -33,9 +33,18 @@ linting:
3333
- `@ViewChild`/`@ContentChild``viewChild()`/`contentChild()`
3434

3535
Services tightly coupled to Angular should use signals. Services with business logic should prefer
36-
RxJS for portability. Use `toSignal()` and `toObservable()` to bridge between the two when needed.
36+
RxJS for portability. Use `toSignal()` and `toObservable()` to bridge between RxJS and signals when
37+
necessary.
3738

38-
Existing code will be migrated gradually. New code must use signal-based APIs.
39+
## Implementation Plan
40+
41+
New code must use signal-based APIs; existing code will be migrated gradually. Angular provides
42+
automatic code migrations for signal
43+
[inputs](https://angular.dev/reference/migrations/signal-inputs) and
44+
[queries](https://angular.dev/reference/migrations/signal-queries).
45+
46+
Much of `libs/components` was updated using these migrators:
47+
https://github.com/bitwarden/clients/pull/15340
3948

4049
## Consequences
4150

@@ -57,7 +66,7 @@ Existing code will be migrated gradually. New code must use signal-based APIs.
5766

5867
- Disallow usage of signals and only use RxJS for reactivity.
5968
- This is a non-starter. Signals are being built into Angular.
60-
- Continue the status quo of adhoc usage.
69+
- Continue the status quo of ad hoc usage.
6170
- Having multiple ways to do the same thing leads to analysis paralysis and complicated code.
6271
- Signals + OnPush change detection provide a clear path to removing Zone.js. With that comes
6372
notable performance and debugging improvements.

docs/contributing/code-style/web/angular.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ component "Organization Reports Module" {
212212
@enduml
213213
```
214214
215-
## Reactivity ([ADR-0003](../../../architecture/adr/0003-observable-data-services.md) & ADR-0028)
215+
## Reactivity ([ADR-0003](../../../architecture/adr/0003-observable-data-services.md) & [ADR-0029](../../../architecture/adr/0029-angular-signals.md))
216216
217217
We make heavy use of reactive programming using [Angular Signals][signals] & [RxJS][rxjs]. Generally
218218
components should always derive their state reactively from services whenever possible.

0 commit comments

Comments
 (0)