ampproject / ampproject/amp-sw
Caching amp-list responses (particularly for when offline)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 70
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
The SW caches a number of URL types (images, documents, etc). One that appears to be missing is `` API calls. Consider a category page on an ecomm site. It might fetch a default set of products to show on the category page, but if there is a network problem, no cache will be used to display the old set of products.
I think can assume the server will return HTTP headers saying how long the response can be cached for (including '0' for "do not cache this resource"). If a request is made when there is no network, it would be good to:
(1) Display the old page (better than displaying nothing).
(2) Indicate the network is temporarily offline / unreliable.
Not as important as the other caches, but I thought I would mention it / ask why it is not supported.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by reviewing the service worker's existing URL-cache handling and the treatment of AMP list API requests. Done should include honoring response cache headers, serving a cached response offline when available, and indicating that the network is offline or unreliable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100