Title: [feature] variants: overriding components & routes (aka experiments support) · Issue #11151 · angular/angular · GitHub
Open Graph Title: [feature] variants: overriding components & routes (aka experiments support) · Issue #11151 · angular/angular
X Title: [feature] variants: overriding components & routes (aka experiments support) · Issue #11151 · angular/angular
Description: [x] feature request This is a summary of a design discussion with @tbosch and @vsavkin. Applications commonly need to support multiple variants out of the same code base. That is, we need to serve a slight variation of our application un...
Open Graph Description: [x] feature request This is a summary of a design discussion with @tbosch and @vsavkin. Applications commonly need to support multiple variants out of the same code base. That is, we need to serve ...
X Description: [x] feature request This is a summary of a design discussion with @tbosch and @vsavkin. Applications commonly need to support multiple variants out of the same code base. That is, we need to serve ...
Opengraph URL: https://github.com/angular/angular/issues/11151
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[feature] variants: overriding components & routes (aka experiments support)","articleBody":"```\n[x] feature request\n```\n\nThis is a summary of a design discussion with @tbosch and @vsavkin.\n\nApplications commonly need to support multiple **variants** out of the same code base. That is, we need to serve a slight variation of our application under certain circumstances, but at the same time still need to serve the original version.\n\nCommon use cases:\n- experiments, e.g. shipping a slightly different app to 1% of your users\n- special events (on Black Friday, serve a different app)\n- shipping an admin version to some users\n- incrementally rolling out a feature\n- etc.\n\nAll of these have in common that we only want to surgically vary a specific part of our app under some circumstances, but not wholesale replace or fork the code base. Another consideration is that we'll have many of these variants available concurrently, and an individual app download might need to include multiple variations at the same time (admin user on Black Friday or so). Yet another thing is that disabled variants should have no effect on the served code of the rest of the application at all, i.e. they can be used for code hiding of unlaunched features.\n\nThe basic idea is to encapsulate variants in source files, with the source files patching global symbols on load, and in that way changing how the application behaves. The server side chooses to serve the appropriate combination of source files to a user, depending on what variants apply to them, or the client side lazily loads particular variants as needed.\n\nThere are two use cases we should support initially:\n1. changing how a single component behaves\n2. adding an entire route to the application\n# Components\n\nFor components, from the user side we'll support syntax like this:\n\n``` ts\n@Component({\n ...,\n overrides: OriginalComponent,\n})\nclass ComponentVariant implements OriginalComponent { ... }\n```\n\nWorth noting: `ComponentVariant` must be assignment compatible to `OriginalComponent` (e.g. implement its interface), as it will be injected in place of `OriginalComponent` across the application. Also, `ComponentVariant` must have the same content view projection as `OriginalComponent`, so it can be a drop in from the Angular 2 component side of things.\n# Routes\n\nFor routes, the basic idea is to lazily load routes that contain variants:\n\n``` ts\nexport const routes: Routes = [\n ...,\n {path: '', loadChildren: 'some-id'},\n];\n```\n\nThe module loader then has a chance to inspect `'some-id'` and load the appropriate module (or even have the server side return the appropriate module). There will likely be a nicer API wrapping this, but it might be specific to the module loader used.","author":{"url":"https://github.com/mprobst","@type":"Person","name":"mprobst"},"datePublished":"2016-08-29T21:20:26Z","url":"https://github.com/angular/angular/issues/11151"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6969f0df-7555-1981-d27b-183f08d8c8dd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9CDE:2E124E:60E735:7D66FC:6B00DFF0 |
| html-safe-nonce | 195a600cf29d96d413e92a7e836f10e46052e4dc8bdbba88b710f570a3975ffe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0RFOjJFMTI0RTo2MEU3MzU6N0Q2NkZDOjZCMDBERkYwIiwidmlzaXRvcl9pZCI6IjQ4NDYxNDAyNDQ3MzI0NjkyMzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 11fc93c84b616ea44b68ce609ebf239596d5076083d0273c1958f679edc9f503 |
| hovercard-subject-tag | issue:173875480 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/11151/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f4fee5d462c74bdf94714a1f1430d0884cb0d71c6f9dec0cfbeb0ffa48dc99e3/angular/angular/issues/11151 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f4fee5d462c74bdf94714a1f1430d0884cb0d71c6f9dec0cfbeb0ffa48dc99e3/angular/angular/issues/11151 |
| og:image:alt | [x] feature request This is a summary of a design discussion with @tbosch and @vsavkin. Applications commonly need to support multiple variants out of the same code base. That is, we need to serve ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mprobst |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width