Title: feat(service-worker): improve default `SwRegistrationStrategy` · Issue #34464 · angular/angular · GitHub
Open Graph Title: feat(service-worker): improve default `SwRegistrationStrategy` · Issue #34464 · angular/angular
X Title: feat(service-worker): improve default `SwRegistrationStrategy` · Issue #34464 · angular/angular
Description: The problem In order to avoid negatively affecting the initial page-load time, @angular/service-worker will (by default) wait for the app to stabilize, before registering the SW script. This can lead to a situation where the SW will neve...
Open Graph Description: The problem In order to avoid negatively affecting the initial page-load time, @angular/service-worker will (by default) wait for the app to stabilize, before registering the SW script. This can le...
X Description: The problem In order to avoid negatively affecting the initial page-load time, @angular/service-worker will (by default) wait for the app to stabilize, before registering the SW script. This can le...
Opengraph URL: https://github.com/angular/angular/issues/34464
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"feat(service-worker): improve default `SwRegistrationStrategy`","articleBody":"**The problem**\r\n\r\nIn order to avoid negatively affecting the initial page-load time, `@angular/service-worker` will (by default) wait for the [app to stabilize][1], before registering the SW script. This can lead to a situation where the SW will never be registered when there is a long-running task (such as an interval or recurring timeout), which can often be started by a 3rd-party dependency (without the developer realizing). Related issues: #20970, #34461\r\n\r\nThis can easily be missed by the developer and there is no other indication other than the SW is not in effect. This is particularly hard to detect, because the SW is typically not used during development and on production builds a previous SW instance might be in effect.\r\n\r\n##\r\n**Possible solutions**\r\n\r\nSince 4cfba5807, it is possible to overwrite this default behavior by [providing a different `SwRegistrationStrategy`][2]. Things we could do to remedy the situation (non-exhaustive list; up for discussion):\r\n\r\n- Change the default strategy to a custom one that wait for the app to stabilize, but registers anyway after X seconds (no matter whether stabilized or not).\r\n\r\n- Keep the current behavior, but print a warning after X seconds that the app has not stabilized yet and the SW has not been registered. (This won't change the current behavior, but will make it easier for developers to identify the problem.)\r\n\r\n[1]: https://angular.io/api/core/ApplicationRef#is-stable-examples\r\n[2]: https://angular.io/api/service-worker/SwRegistrationOptions#registrationStrategy","author":{"url":"https://github.com/gkalpak","@type":"Person","name":"gkalpak"},"datePublished":"2019-12-18T10:03:57Z","url":"https://github.com/angular/angular/issues/34464"}
| 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:832d3f9c-d972-c5b8-f5fa-553b9aa418ac |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EB5E:28815B:B9770E:F8A7B5:6B00F56F |
| html-safe-nonce | 54b4d7cabfb58a4930bb10fffbf4574a9849960d346039c4c2e4ffbc77c97099 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjVFOjI4ODE1QjpCOTc3MEU6RjhBN0I1OjZCMDBGNTZGIiwidmlzaXRvcl9pZCI6Ijg4NjEwNTQyODgzOTExMDc5NTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0522eb4390793fd0be64196c5b53de90fc9bac83b99f5c07c451fd2dc221be7b |
| hovercard-subject-tag | issue:539578209 |
| 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/34464/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0b72858da9b4b1f047fc2621e27700ff7a3cc270661f649199f8c4d21d6bf6dc/angular/angular/issues/34464 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0b72858da9b4b1f047fc2621e27700ff7a3cc270661f649199f8c4d21d6bf6dc/angular/angular/issues/34464 |
| og:image:alt | The problem In order to avoid negatively affecting the initial page-load time, @angular/service-worker will (by default) wait for the app to stabilize, before registering the SW script. This can le... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gkalpak |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width