Skip to content

feat(plus/offline): add offline mode using yari client - #531

Merged
caugner merged 2 commits into
mainfrom
fred-offline
Aug 14, 2025
Merged

feat(plus/offline): add offline mode using yari client#531
caugner merged 2 commits into
mainfrom
fred-offline

Conversation

@LeoMcA

@LeoMcA LeoMcA commented Aug 11, 2025

Copy link
Copy Markdown
Member

Relates to: #525

Would advise reviewing commit-by-commit, as the first commit simply copies over the pwa files from yari (with prettier applied), and the second commit makes the real changes to support offline in fred.

Testable in the review environment (if you do the login dance with replacing the url), but I'll be deploying this specially to test too (to test the yari -> fred "migration").

You'll know it's working if, after downloading, yari starts rendering pages instead of fred. Disable "prefer offline" to get fred rendering pages until you pull the network cable.

@github-actions

github-actions Bot commented Aug 11, 2025

Copy link
Copy Markdown
Contributor

990940d was deployed to: https://fred-pr531.review.mdn.allizom.net/

@LeoMcA
LeoMcA marked this pull request as ready for review August 14, 2025 08:11
@LeoMcA
LeoMcA requested a review from mdn-bot as a code owner August 14, 2025 08:11
@LeoMcA
LeoMcA requested a review from a team August 14, 2025 08:11

@caugner caugner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, and tested.

  1. After enabling MDN Offline Storage, status says "Up to date" (an old issue):
    image
  2. After enabling auto-update, it starts downloading:
    image
  3. Then it starts unpacking:
    image
  4. After finishing unpacking, it shows "Up to date", while "Storage used" still shows "0 MiB":
    image
  5. After refreshing the page, the button colors changed, and "Storage used" shows up as "257 MiB":
    image
  6. After enabling "Prefer online content", and refreshing:
    image
  7. Browsing with "Prefer online content" enabled seems to work (shows fred).
  8. Browsing with "Prefer online content" disabled seems to work (shows yari from December).
  9. After clicking "Clear data", downloading starts again (probably an old issue):
    image
  10. Trying to cancel the download by disabling auto-update, and refreshing, doesn't seem to load (probably an old issue), but works after hard-reload, although status remains "Downloading…" (because we don't support cancelling the download/unpack process).
  11. After disabling "MDN Offline Storage" again, this setting persist after a refresh.

Comment thread vendor/yari/client/pwa/README.md
@caugner caugner changed the title feat: add offline mode using yari client feat(plus/offline): add offline mode using yari client Aug 14, 2025
@LeoMcA

LeoMcA commented Aug 14, 2025

Copy link
Copy Markdown
Member Author

After enabling MDN Offline Storage, status says "Up to date" (an old issue):

I had a go at fixing this in mdn/yari#13386, but this causes problems of its own (the button looks clickable but doesn't do anything until the service worker has cached the static assets and activated). I'll have another attempt at fixing this later today.

@caugner
caugner merged commit bbe86c5 into main Aug 14, 2025
7 checks passed
@caugner
caugner deleted the fred-offline branch August 14, 2025 09:15
Comment thread package.json
"css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.2",
"dexie": "^4.0.11",
"downshift": "^9.0.10",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LeoMcA Do you remember why you added downshift as a Fred dependency here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants