-
-
Notifications
You must be signed in to change notification settings - Fork 70
feat: add offline support #80
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: add offline support #80
Conversation
All right, so the biggest problem with that is to wait for parcel to bundle the app and then generate service worker that will precache all the files. I will try to make it work. |
…g-playground into feature/pwa-service-worker
Ok, so client files in main directory are cached properly. I have to work out how to make it work with Netlify redirects to cache all the files for offline usage, because currently the state of PWA is that it doesn't serve the index.html from cache. I'll have a look at it later. |
…g-playground into feature/pwa-service-worker
…g-playground into feature/pwa-service-worker
…g-playground into feature/pwa-service-worker
…g-playground into feature/pwa-service-worker
…g-playground into feature/pwa-service-worker
…g-playground into feature/pwa-service-worker
…g-playground into feature/pwa-service-worker
Alright, so basically I've got it working. It needs some polishing (manifest icons are not loaded) and I've got one problem: URL without |
I can happily confirm that offline veriosn is working properly. |
@smeijer can you have a look at that? I guess if it's not on the roadmap, it's less important, but I still did it. |
I'll check this tomorrow. As it's about bed time in my timezone. I need to read into workbox, as I've never heard of it before. And a quick look also makes me wonder if the chunks of javascript really need to be in those html files. But that's just a quick 2 minute glimpse at the diff. I'll come back to you with a more complete response. Again, thanks for contributing. Offline functionality wasn't added to roadmap.md, but it is definitely something great to have. Hence the issue. |
The only part necessary is: const sw = '/sw.js';
navigator.serviceWorker.register(sw) the line with |
@Siemko, sorry it took me so long. I have a couple of questions/suggestions;
|
Agreed, I also included production env checking.
I have taken it out from CRA. :) Sure will add the fancy button or any other message.
Yes, I forgot to include env checking. Still working on that fancy alert/button thing. Can you tell me, how should it look? |
This is how Google does it, what do you think? Maybe we can use react-toastify for it? That would also allow us to show a toast for other actions (like copy to clipboard) later. |
@smeijer sorry for the late response, I gave it a shot, I put react-toastify there as suggested. |
@Siemko, I think it's looking great! Few things though,
I can't wait to have this branch merged. Great work! 😎 |
@smeijer, thank you :)
Uploading new version of built files (so, basically files with new hashes) will trigger the SW to update. It is based on "manifest", that is generated on each build. So, basically it's available now!
Done.
I've solved that issue before, here's little PoC:
Me too 👍 |
@Siemko thanks for this one! Awesome work. I've:
I hope you don't mind 😇 Again, thanks. This is really nice. |
Awesome, thank you @smeijer. Glad you put it up into work :) |
@all-contributors please add @Siemko for code |
I've put up a pull request to add @Siemko! 🎉 |
Hi there, so basically I've seen #29 and thought of giving it a try. I used some basic service worker to cache everything on
/
route. Let me know if this is enough.