Skip to content

Conversation

@willmartian
Copy link

@willmartian willmartian commented Jul 22, 2025

🎟️ Tracking

https://bitwarden.atlassian.net/browse/CL-875

📔 Objective

Adds an ADR that describes our preference for signals over RxJS in Angular components.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation
    team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed
    issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@github-actions github-actions bot added the adr label Jul 22, 2025
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jul 22, 2025

Deploying contributing-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: c977fa5
Status: ✅  Deploy successful!
Preview URL: https://c235cbb4.contributing-docs.pages.dev
Branch Preview URL: https://signals-adr.contributing-docs.pages.dev

View logs

@github-actions
Copy link
Contributor

github-actions bot commented Jul 22, 2025

Logo
Checkmarx One – Scan Summary & Detailsd2e4f0a0-08d9-4d32-b32e-bf8224e99acd

Great job! No new security vulnerabilities introduced in this pull request

@willmartian willmartian changed the title 0027 - Adopt Angular Signals for Component State 0028- Adopt Angular Signals for Component State Nov 24, 2025
@willmartian willmartian requested a review from Hinton November 24, 2025 18:54
@willmartian willmartian marked this pull request as ready for review November 24, 2025 18:59
@willmartian willmartian requested a review from a team as a code owner November 24, 2025 18:59
@willmartian willmartian changed the title 0028- Adopt Angular Signals for Component State [CL-875] 0028 - Adopt Angular Signals for Component State Nov 24, 2025
@claude
Copy link

claude bot commented Nov 24, 2025

Claude finished @willmartian's task —— View job


Review complete

This ADR documents an important architectural decision for Angular development at Bitwarden. The structure follows the established ADR pattern well, and the decision is clearly explained.

Summary of findings

Finding 1: Performance claim needs supporting evidence or clarification (💭)

Finding 2: Grammatical issue with punctuation in line 17 (⚠️)

Finding 3: Consider adding concrete examples to distinguish UI-coupled vs business logic services (🎨)

Finding 4: Typo - "adhoc" should be "ad hoc" (⚠️)

Finding 5: Migration strategy could be more detailed, similar to ADR 0027's implementation plan (💭)

PR metadata

The PR title and description are clear and appropriate for a documentation change. The objective clearly explains that this adds an ADR about preferring signals over RxJS in Angular components.

What was done well

The ADR effectively articulates the rationale for adopting signals, provides clear API migration paths, and thoughtfully addresses portability concerns for non-Angular environments.



## Context and Problem Statement

Angular has adopted a new reactive primitive, signals. Signals have various improvements over RxJS:
Copy link

Choose a reason for hiding this comment

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

💭 The claim about "performance" as an improvement needs clarification or evidence. While signals can optimize change detection, the performance benefit depends heavily on usage patterns. Consider either:

  • Adding a reference/link to Angular docs or benchmarks that demonstrate this
  • Softening the claim (e.g., "potential performance improvements in certain scenarios")
  • Providing specific context about what performance aspects improve

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
Copy link

Choose a reason for hiding this comment

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

⚠️ This sentence has a grammatical issue with the double dash. Use an em dash with spaces or a proper punctuation mark:

Suggested change
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,

or

Suggested change
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,

Comment on lines +21 to +24
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).
Copy link

Choose a reason for hiding this comment

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

🎨 The guidance here is good but could benefit from examples of "services tightly coupled to the UI/Angular" vs "services with business logic." This would help developers make the right choice when implementing. Consider adding a brief example or two in a <details> block.


- 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.
Copy link

Choose a reason for hiding this comment

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

⚠️ Typo: "adhoc" should be hyphenated or two words.

Suggested change
- Continue the status quo of adhoc usage.
- Continue the status quo of ad hoc usage.

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.
Copy link

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.

Copy link
Contributor

@theMickster theMickster Nov 25, 2025

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

Copy link
Member

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.

Copy link
Contributor

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.

@withinfocus
Copy link
Contributor

I like the Claude feedback as of this writing so let's continue improving that. There's also https://contributing.bitwarden.com/contributing/code-style/web/angular/#reactivity-adr-0003--adr-0028 which can get a formal link.


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
Copy link
Contributor

@theMickster theMickster Nov 25, 2025

Choose a reason for hiding this comment

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

🎨 I am good with the comment that suggests the usage of the Rust SDK.
That being said, I think it is important that an ADR be written to clearly describe that process. I do not currently see one published to our ADR Wiki.

I think it important for a few reasons:
A.) The codifying of the decision and migration plan to the Rust SDK aligns perfectly with our ADR mission statement
B.) Crafting it leaves behind a clear trail for teammates new and old to follow; minimized tribal knowledge around the migration
C.) Claude Code (or other agents) will hopefully be able to leverage the ADR to make suggestions to teammates working in the clients repo to move said business logic to the Rust SDK.

💭@Hinton, @withinfocus, @MGibson1?

- `@Output()` → `output()`
- `@ViewChild`/`@ContentChild` → `viewChild()`/`contentChild()`

Services tightly coupled to Angular should use signals. Services with business logic should prefer
Copy link
Member

Choose a reason for hiding this comment

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

I think it's worth calling out it's non presentational logic.

Suggested change
Services tightly coupled to Angular should use signals. Services with business logic should prefer
Services tightly coupled to Angular should use signals. Services with non-presentational business logic should prefer

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.
Copy link
Member

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.

@Hinton
Copy link
Member

Hinton commented Nov 25, 2025

Can we add a admonitions to https://contributing.bitwarden.com/architecture/adr/observable-data-services linking to this ADR? I think it slightly supersedes the existing one.

@withinfocus
Copy link
Contributor

ADR 28 has just been taken by the way: https://contributing.bitwarden.com/architecture/adr/adopt-fusion-cache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants