Page MenuHomePhabricator

[Cashtab] [service worker fix p3] Add modal to load latest version on app update
ClosedPublic

Authored by bytesofman on Sep 21 2022, 18:23.

Details

Summary

T2684

Depends on D12021

Add a modal to notify the user that a more recent version of Cashtab is available with a confirmation option that will reload the page and get the latest version.

This implementation is modeled from this summary: https://felixgerschau.com/create-a-pwa-update-notification-with-create-react-app/

Test Plan

npm run build
Deploy the site somehow (I used netlify). Visit the site and verify that there is a service worker by opening the dev console and clicking on Application --> Service Workers
Make a visible change. One of the easiest is to change teh WalletLabel.js component to add a new string after the {name} variable inside <WalletName></WalletName>
npm run build
Deploy the site to the same URL
Give it about a minute. You should see the modal introduced in this diff.
Click 'OK' and the page will reload.
You should be able to see your change on the reloaded page.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Note: this implementation intentionally omits the ServiceWorkerWrapper component from the browser extension

emack requested changes to this revision.Sep 22 2022, 13:53
emack added a subscriber: emack.
  • Once I redeployed the netlify cashtab, the app update modal didn't trigger at all (I waited for about 10 mins) until I refreshed the the browser. Even moving around the different screens couldn't trigger the modal. The serviceworker is definitely activated and running.
  • The Cancel button on the model doesn't respond.
web/cashtab/src/components/Common/ServiceWorkerWrapper.js
25 ↗(On Diff #35092)

needs an onCancel which sets showReloadModal to false

This revision now requires changes to proceed.Sep 22 2022, 13:53

Remove cancel option, trigger update even on user clicking 'x'

This revision is now accepted and ready to land.Sep 22 2022, 16:03