Skip to content
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

feat: prompt user to reload when updates available #21

Merged
merged 3 commits into from
Aug 2, 2018

Conversation

olizilla
Copy link
Member

@olizilla olizilla commented Aug 2, 2018

When the service worker finds updates, tell the user and ask them to reload.

screenshot 2018-08-02 12 53 16

License: MIT
Signed-off-by: Oli Evans oli@tableflip.io

When the service worker finds updates, tell the user
and ask them to reload.

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
@olizilla olizilla requested a review from hacdias August 2, 2018 11:58
@olizilla
Copy link
Member Author

olizilla commented Aug 2, 2018

Tricky to test this one without setting up local https. create-react-app sets up a service worker so the app works offline, but this leads to surprising behaviour where you don't get the latest version until you reload the page. With this PR we tell the user, rather than hope they guess.

We'll want something similar for webui. It's questionable if we want a service worker caching webui if it is intended to be hosted from a ipfs daemon, but as @lidel points out we want the app to work well in all scenarios.

@victorb
Copy link
Member

victorb commented Aug 2, 2018

Oh, nice! Slightly unrelated thought, could we somehow get this into a reusable module that can also be used for sites that are loaded via /ipfs/ but with a hardcoded ipns key that the update can be checked from? Then people can still bookmark the immutable version, but get notifications about updates via ipns.

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
Copy link
Member

@hacdias hacdias left a comment

Choose a reason for hiding this comment

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

lgtm 😄

registerServiceWorker assumes a window object,
so we make it optional for tests, and pass it
to App as a prop.

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
@olizilla
Copy link
Member Author

olizilla commented Aug 2, 2018

@victorbjelkholm cool idea! I think we'll want something like that for the webui.

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