Skip to content

Datagroups defined in service worker config are purged when app is updated #20785

@atsjo

Description

@atsjo

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

When publishing a new version of an app with a service worker, the datagroups are purged together with the old assets cached, even if the version of the datagroup is the same.

Expected behavior

Cached responses in datagroups are kept, unleless datagroup version is changed.

Minimal reproduction of the problem with instructions

  • Create app with service worker (can use the current cli 1.5.5): ng new testapp --service-worker
  • Use cli 1.6 rc in package.json to support building service worker
  • Add a datagroup to cache api respones, and cache data
  • make a new build and publish this, then observe in devtools how the cache and metadata for the datagroup are purged when app is updated (the caches are deleted, not only the content)

What is the motivation / use case for changing the behavior?

From what I could read in the docs, the expected behaviour is how this functionality is supposed to work. For small api respones the current behaviour is not a big problem, but when caching lots of media files for offline playback, it is...

Environment


Angular version: 5.0.0 - 5.1.0-rc.1


Browser:
- [x] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [x] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [x] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: service-workerIssues related to the @angular/service-worker packagefreq3: highopen for contributionsAn issue that is suitable for a community contributor (based on its complexity/scope).state: confirmedtype: bug/fix

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions