[PM-35224] Add route provider parameters support to featureFlaggedRoute#20235
[PM-35224] Add route provider parameters support to featureFlaggedRoute#20235
Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #20235 +/- ##
==========================================
+ Coverage 47.01% 47.12% +0.11%
==========================================
Files 3892 3898 +6
Lines 117254 117586 +332
Branches 17933 18005 +72
==========================================
+ Hits 55122 55414 +292
- Misses 59645 59673 +28
- Partials 2487 2499 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Great job! No new security vulnerabilities introduced in this pull request |
| * // Only instantiated when the feature flag is OFF | ||
| * safeProvider({ provide: LegacyGroupsService, useClass: LegacyGroupsService, deps: [...] }), | ||
| * ], | ||
| * flaggedRouteProviders: [ |
There was a problem hiding this comment.
❓ What's the specific use case for this? Couldn't the existing and flagged component just create their own providers? As for example:
https://github.com/bitwarden/clients/blob/main/bitwarden_license/bit-web/src/app/dirt/reports/member-access-report/member-access-report.component.ts#L59
Then using this or the https://github.com/bitwarden/clients/blob/main/libs/angular/src/platform/guard/feature-flag.guard.ts would be sufficient.
I still wonder why we have two of these 🤷
There was a problem hiding this comment.
An example is in this pull request for Access Intelligence refactoring in the routing module.
Two main reason: performance and unintended background execution
Sever Access Intelligence services have been refactored that start observable pipelines in the constructor. Route level providers scope the instantiation to when that route is actually activated, so only when the feature flag is on. Many of these services are also needed in many components rather than just one. The main service that benefits from this approach is the AccessIntelligenceDataService replacing the RiskInsightsOrchestratorService.
We could work around this by changing the services by exposing an initialize method to start the service, but I feel this adds a lot of overhead. The proposed change felt clean and clear to me




🎟️ Tracking
[Client] Add route provider parameters support to featureFlaggedRoute
📔 Objective
Extends
featureFlaggedRouteto support scoped service providers on each side of a feature flag. Previously, any services exclusive to the flagged or default experience had to be registered at the module level and were instantiated unconditionally. Route-level providers create a child injector Angular only activates when the route is entered, enabling true lazy initialization.Changes:
flaggedRouteProvidersanddefaultRouteProviderstoFeatureFlaggedRouteConfig@exampleshowing scoped-provider usage