Repository navigation
Description
🚀 feature request
Relevant Package
This feature request is for @angular/service-worker.
Description
The Angular Service Worker currently prefetches a new version assets one by one, as mentioned in
| // Cache all known resources serially. As this reduce proceeds, each Promise waits |
// Cache all known resources serially. As this reduce proceeds, each Promise waits
// on the last before starting the fetch/cache operation for the next request. Any
// errors cause fall-through to the final Promise which rejects.
Doing so with a medium/large application that heavily leverage code-splitting in inefficient: in our case we have ~340 assets to prefetch, for a total application size of only 3.0MB, yet upgrades a taking several minutes (sometimes above > 10 minutes) to be ready.
This leads to app upgrades being slower to propagate as they should be, as users have to stick around several minutes within the app for us to be able to switch to (or notify them about) the new version.
Describe the solution you'd like
New versions assets should be prefetched by the Service Worker in parallel. 3MB only takes a second to download on the average broadband connection thanks for h2+ parallelism, and the Angular Service Worker should leverage that.
Describe alternatives you've considered
I am unused if the current behavior was designed on purpose.
Activity
gkalpak commentedon Oct 30, 2020
I assume this was done to prevent network congestion (@alxhub could confirm).
I still believe it should be the default behavior (or maybe have a few parallel requests to speed things up a bit). But maybe we could allow specifying the desired parallelism in the asset-group entry in
ngsw-config.json.This is not a high priority, so not sure when/if we are going to get to it, but if anyone is interested in working on a PR I would be happy to help/review.
angular-robot commentedon Jun 4, 2021
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.
Find more details about Angular's feature request process in our documentation.
angular-robot commentedon Jun 24, 2021
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.
We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
You can find more details about the feature request process in our documentation.
2 remaining items
dylhunn commentedon Sep 29, 2022
We consider this degraded performance a bug in service worker. The user should not have to remain on the app for several minutes to get the update.
jvitor83 commentedon Dec 21, 2022
This should be a priority. The prefetch should behave like the browser once it hits the page (downloading the assets at the same time), otherwise the loading will be slower than without service worker.
gkalpak commentedon Dec 21, 2022
FWIW, prefetching does not affect the loading time of the page, since it happens in the background (independently of the page loading process).
jvitor83 commentedon Dec 25, 2022
Yes. In my case at the first access i preffer to not show the cached version of the app, but instead a loading screen while it updates and reload (to avoid a eventual breaking change in API make the cached version unusable or gives error).
In that case, the loading time seems slower than browser because of the downloading assets in sequence, and this issue can drastically improve that performance.
jvitor83 commentedon May 13, 2024
Any news about this? The PR is one year old! 🎂
@gkalpak
JeanMeche commentedon Aug 29, 2025
With #63364 we've announced that the service-worker package in now in maintenance mode and will not receive feature PRs and feature requests.
The message is also visible here: https://angular.dev/ecosystem/service-workers
angular-automatic-lock-bot commentedon Sep 29, 2025
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.