Title: service-worker: configure response status codes to treat as failed/offline with freshness strategy · Issue #45954 · angular/angular · GitHub
Open Graph Title: service-worker: configure response status codes to treat as failed/offline with freshness strategy · Issue #45954 · angular/angular
X Title: service-worker: configure response status codes to treat as failed/offline with freshness strategy · Issue #45954 · angular/angular
Description: Deliver web apps with confidence 🚀. Contribute to angular/angular development by creating an account on GitHub.
Open Graph Description: Deliver web apps with confidence 🚀. Contribute to angular/angular development by creating an account on GitHub.
X Description: Deliver web apps with confidence 🚀. Contribute to angular/angular development by creating an account on GitHub.
Opengraph URL: https://github.com/angular/angular
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"service-worker: configure response status codes to treat as failed/offline with freshness strategy","articleBody":"### Which @angular/* package(s) are the source of the bug?\r\n\r\nservice-worker\r\n\r\n### Is this a regression?\r\n\r\nNo\r\n\r\n### Description\r\n\r\n\r\nExpected behaviour: freshness strategy should return to user fetching requested data only if request was successful.\r\nIf request is unsuccessful (has 500, 504 and other codes) it should return cached result instead of bad result. And bad result should not be cached at all.\r\n\r\nBut in reality:\r\n\r\nfreshness strategy return for user bad results.\r\n\r\nInterestingly, freshness strategy works as expected if web-server absolutely died (network error: connection refused). I mean, all configured in dataGroup requests begin to return from cache and web-application works despite dead backend. It is different with particular bad request (as I described above).\r\n\r\nPerformance strategy works as expected (it returns cached results firstly)\r\n\r\n### Please provide a link to a minimal reproduction of the bug\r\n\r\n_No response_\r\n\r\n### Please provide the exception or error you saw\r\n\r\n_No response_\r\n\r\n### Please provide the environment you discovered this bug in (run `ng version`)\r\n\r\n```true\r\nAngular CLI: 11.2.19\r\nNode: 14.8.2\r\nOS: darwin x64\r\n\r\nAngular: 11.2.14\r\n```\r\n\r\n\r\n### Anything else?\r\n\r\nhttps://angular.io/guide/service-worker-config#datagroups\r\n\r\nhttps://stackoverflow.com/questions/69132411/angular-service-worker-return-cached-response-if-server-returns-error\r\n\r\n","author":{"url":"https://github.com/anton-marchenko","@type":"Person","name":"anton-marchenko"},"datePublished":"2022-05-11T13:38:13Z","url":"https://github.com/angular/angular/issues/45954"}
| 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 | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:79943f28-2064-b6d6-9f27-5fee8c6f109b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D1FC:2C4BED:E094E7:11EA3C1:6B01078F |
| html-safe-nonce | 955d6b65333dc4c31b3d5ba936b4dbaf7d2e5a83d28fdb3c8ce0b6944d423cbf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMUZDOjJDNEJFRDpFMDk0RTc6MTFFQTNDMTo2QjAxMDc4RiIsInZpc2l0b3JfaWQiOiI0OTIzNzk5NzY0NjE0NTgwMTExIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d0a49d9f93222286d87d6230f7abab66a71fb6c9159ef9cfac016a41cee48fb6 |
| hovercard-subject-tag | repository:24195339 |
| 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/angular/angular/issues/45954 |
| twitter:image | https://repository-images.githubusercontent.com/24195339/d4194dc2-d880-43f7-960c-ea30e05c6531 |
| twitter:card | summary_large_image |
| og:image | https://repository-images.githubusercontent.com/24195339/d4194dc2-d880-43f7-960c-ea30e05c6531 |
| og:image:alt | Deliver web apps with confidence 🚀. Contribute to angular/angular development by creating an account on GitHub. |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| turbo-cache-control | no-cache |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width