-
Notifications
You must be signed in to change notification settings - Fork 26.1k
feat(service-worker): allow specifying maxAge for entire application #49601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Wasn't sure exactly what API to use / where to put it - I've put it in the Linked issue could also be solved by setting |
Hmm, I've realised that this doesn't work properly if the service worker process is shut down, as it will recreate the state and reset |
367bcea
to
e4a6a6e
Compare
@henry-alakazhang Sorry this never got a code review. We think it's a reasonable change. Can you rebase? I'll take a look after you're able to do that. |
This commit adds an `applicationMaxAge` to the service worker configuration. When set, it will only assign a cached version to clients within the `maxAge`. Afterwards, it will ignored any expired application versions and fetch exclusively from the network. The default is `undefined`, for which the behaviour is the same as it currently is.
e4a6a6e
to
25a465b
Compare
Sure, I've updated the PR (hopefully I rebased everything correctly and these things are all still in the right place). |
Hi @thePunderWoman, would you be able to take a look at this now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for your contribution!
Caretaker note: this is safe to merge with current approvals as it was discussed during a triage meeting. |
This PR was merged into the repository by commit 8ddce80. The changes were merged into the following branches: main |
…ngular#49601) This commit adds an `applicationMaxAge` to the service worker configuration. When set, it will only assign a cached version to clients within the `maxAge`. Afterwards, it will ignored any expired application versions and fetch exclusively from the network. The default is `undefined`, for which the behaviour is the same as it currently is. PR Close angular#49601
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This commit adds an
applicationMaxAge
to the service worker configuration. When set, it will only assign a cached version to clients within the maxAge. Afterwards, it will ignored any expired application versions and fetch exclusively from the network. The default isundefined
, for which the behaviour is the same as it currently is.PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #39266
The index file (and therefore all application navigations) are cached indefinitely by the service worker.
What is the new behavior?
An optional
applicationMaxAge
field in the service worker ignores the cache for all requests for versions older than that age.Does this PR introduce a breaking change?
(field is optional)
Other information