ampproject / ampproject/amp-sw

Caching amp-list responses (particularly for when offline)

Open
#11 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.