-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Offline behaviour discussion #2750
Comments
Sorry but I'm not satisfied by this.
In the links you've sent, user must manually make several cache
manipulations to get your app last version (closing tabs, press f5, .... ).
Is that the best thing offlinePlugin can provide ?
…On Fri, Sep 20, 2019 at 2:48 PM Can Sahin ***@***.***> wrote:
Similar to: (if you havent seen already)
#852 <#852>
https://github.com/NekR/offline-plugin/blob/master/docs/updates.md
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2750?email_source=notifications&email_token=ABPAMXOHNAUMLLXLODCMCGTQKTBCBA5CNFSM4IYTEW5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7GSY5Q#issuecomment-533539958>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABPAMXKPDRHRQEG4ZDNLTQLQKTBCBANCNFSM4IYTEW5A>
.
--
Jean Chapelle
|
Just wanted to say that I'm definitely open to having this discussion here (how to improve caching/code splitting/offline for rbp) but I also want to throw it out there that any offline-plugin specific issues/questions should be opened over on that repo, and maybe linked here? Mostly wanted to say this bc we can discuss all we want, but if the main problems @jchapelle and others are finding are bc of offline-plugin, there's not much we can do. |
I agree with you guys.
My original question was : what is the behaviour you guys want ?
…On Fri, Sep 20, 2019, 16:44 Sara Federico ***@***.***> wrote:
Just wanted to say that I'm definitely open to having this discussion here
(how to improve caching/code splitting/offline for rbp) but I also want to
throw it out there that any offline-plugin specific issues/questions should
be opened over on that repo, and maybe linked here? Mostly wanted to say
this bc we can discuss all we want, but if the main problems @jchapelle
<https://github.com/jchapelle> and others are finding are bc of
offline-plugin, there's not much we can do.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2750?email_source=notifications&email_token=ABPAMXIPFX26FRTHKHJGBK3QKTOVXA5CNFSM4IYTEW5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7G5GDI#issuecomment-533582605>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABPAMXJD3QRWGPJ3RWOPUE3QKTOVXANCNFSM4IYTEW5A>
.
|
Getting the same issues - and it's a bit of a problem, so I'm in the process of turning it off for the project. I'll touch back again later today after we're done working through the issue myself. Even if we can't change anything in this repo, I agree with @jchapelle that we should probably know what the issues are, the preferred behavior, and possibly the preferred configuration that's set as the default on RBP. TBF, I'm only getting caught up on these details because this is the first time It's caused any issues for us and we've launch numerous sites with RBP (So thanks for all the hard work everyone!) |
Personally,
Until offlinePlugin does not offer more possibilities (on index.html and
expiration time), I'm disabling it on my projects.
It is more important to me to be able to control the version of the app the
users get than having an offline feature.
…On Fri, Sep 20, 2019 at 7:36 PM Jeff Yamada ***@***.***> wrote:
Getting the same issues - and it's a bit of a problem, so I'm in the
process of turning it off for the project. I'll touch back again later
today after we're done working through the issue myself. Even if we can't
change anything in this repo, I agree with @jchapelle
<https://github.com/jchapelle> that we should probably know what the
issues are, the preferred behavior, and possibly the preferred
configuration that's set as the default on RBP.
TBF, I'm only getting caught up on these details because this is the first
time It's caused any issues for us and we've launch numerous sites with RBP
(So thanks for all the hard work everyone!)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2750?email_source=notifications&email_token=ABPAMXPIUFSG2GKC3ZDSKW3QKUCYRA5CNFSM4IYTEW5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7HMOKY#issuecomment-533645099>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABPAMXOSDLAZV7YPUMBWMWTQKUCYRANCNFSM4IYTEW5A>
.
--
Jean Chapelle
|
I've disabled it as well because it created too many issues. I think the simplest way to deal with all the complications around offline behavior would be for us to switch to workbox-webpack-plugin. It's used by create-react-app (=> MANY users), supported by Google, supports several types of caching strategies and decent documentation. Any thoughts on this idea? Would anyone like to give it a go? Small addendum: I'm not sure of the details but I believe a good offline strategy also requires some server/header configuration so we should remember to update our deployment guides + sample configs (Apache/NGINX/other?) if necessary. |
I'll try to have a look at workbox. During my little inquiry, I did realize
that this was a good alternative to offlinePlugin.
Regarding the operationalization, I'm personnaly using amazon s3 with some
settings on header for some files. It's the cheapest way to deploy a spa
(no server required)
…On Sun, Sep 22, 2019, 13:28 Julien Benchetrit ***@***.***> wrote:
I've disabled it as well because it created too many issues.
I think the simplest way to deal with all the complications around offline
behavior would be for us to switch to workbox-webpack-plugin
<https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin>
.
It's used by create-react-app (=> MANY users), supported by Google,
supports several types of caching strategies and decent documentation.
Any thoughts on this idea? Would anyone like to give it a go?
Small addendum: I'm not sure of the details but I believe a good offline
strategy also requires some server/header configuration so we should
remember to update our deployment guides + sample configs
(Apache/NGINX/other?) if necessary.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2750?email_source=notifications&email_token=ABPAMXPEY3L5LU4T2UJFY4LQK5JHBA5CNFSM4IYTEW5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7JEG5A#issuecomment-533873524>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABPAMXPSVQ7TOELRJHP2TOLQK5JHBANCNFSM4IYTEW5A>
.
|
Yep, spent the last few days removing it. I was seeing some unexpected behavior after removing it though, so it's been a bit of a minefield so I too will be disabling it until I feel more confident we have the control we need and updated deployments will be visible to users. |
Unexpected behavior? I'm assuming the issue is some of your users had a service worker already installed? When you remove it, you need to also ensure that you unregister existing users' service worker. https://create-react-app.dev/docs/making-a-progressive-web-app |
Yep, that's exactly what was happening. I dropped code directly into index.html to unregister them, but it seemed that index.html wasn't updating either so the only way those users could see the update was with a hard refresh. Some users were reporting a blank screen, which I found difficult to replicate or explain. It's been fun. |
😣 It's interesting to notice that CRA made PWA/offline support an opt-in feature because of the caveats. |
Yeah. That seems wise. I haven't had time to dig into this as deeply as I'd like, but oddly we've never had major issues with it in the past, nor really heard users complain that the site wasn't refreshing or updating etc. My hunch right now is that in the more recent versions or updates when we're deploying fresh versions of our RBP site it's not auto refreshing. Sorry if my understanding of all this sounds vague, I've spent more time tinkering and not enough pouring through release notes. |
Is there any more documentation on this? We've been deploying our app in our staging environment and noticed the browser never picks up any changes. Sorry if I'm de-railing a conversation where everyone already knows about OfflinePlugin, but I verified the reason why our site never uncached on deploys was because of this OfflinePlugin. I went into "Service Workers" and hit "Update on reload" and sure enough the latest version of the web app loaded. I'm now disabling and removing offline capabilities since our app will never work offline (nor do we want it to.) But... for someone coming to this project and just doing a normal deployment of their app, this OfflinePlugin totally breaks that? Can someone help here, what's the right way to Deploy a react-boilerplate app and makes sure the cache gets cleared. I've seen people link to the OfflinePlugin (https://github.com/NekR/offline-plugin/blob/master/docs/updates.md). But that's not really helpful.. do I need to add the above to do a deploy of our app? |
From the documentation, it appears that if you have no tabs of the app open, and then open a new tab, it should update? So to uncache:
The above does not work for us. We have no tabs open at all and the only way to load a new version is in an incognito window. What are we doing wrong? |
1. On your project source, remove the offline plugin support. There is 2 places where you need to comment or remove that :
1.1 In the plugin section of production webpack configuration ; remove or comment the plugin OfflinPlugin config
1.2 In the app.js ; comment or remove the "require('offline-plugin/runtime').install();" line
2. Deploy your app
3. Because the new version of the app does not install a new service worker, you need to remove the previous one manually. This does not work by just closing the tab. Closing the tabs allow the previous version to inactivate when a new version if waiting for activation. Thus, with your browser :
3.1 visit your website
3.2 go to developper tools -> application -> service worker
3.3 Click "Unregister" for the service worker registered on your url
4. Reload the website by pressing f5
5. From now on, it should load the last version each time you deploy
…On Tue, Sep 24, 2019 at 11:52 PM Arianit Uka ***@***.***> wrote:
From the documentation, it appears that if you have no tabs of the app
open, and then open a new tab, it should update? So to uncache:
1. Close all tabs of your app
2. Load your site
The above does not work for us. We have no tabs open at all and the only
way to load a new version is in an incognito window. What are we doing
wrong?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2750?email_source=notifications&email_token=ABPAMXKHE4ULRTK5KFKU5V3QLKDZJA5CNFSM4IYTEW5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7P5PSI#issuecomment-534763465>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABPAMXOBBGPBEAWIUV7PQE3QLKDZJANCNFSM4IYTEW5A>
.
--
Jean Chapelle
|
I am in development phase and facing all the above mentioned issue with offline configuration. As a workaround, i have excluded index.html from caching and then service worker is updating fine on new deployment. But the feature of offline is not working because of it. I am also experiencing the blank page issue sometimes, as mentioned by @jeffyamada. |
During my tests, I tried to exclude "index.html" from offlinePlugin
configuration but it was not working properly ...
…On Wed, Sep 25, 2019 at 1:36 PM jhaankit ***@***.***> wrote:
I am in development phase and facing all the above mentioned issue with
offline configuration.
As a workaround, i have excluded index.html from caching and then service
worker is updating fine on new deployment. But the feature of offline is
not working because of it.
Code to exclude: excludes: ['.htaccess', 'index.html'], in
webpack.prod.babel.js
I am also experiencing the blank page issue sometimes, as mentioned by
@jeffyamada <https://github.com/jeffyamada>.
It happens rarely on page-reload.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2750?email_source=notifications&email_token=ABPAMXMNB32S6AS326263Z3QLNELZA5CNFSM4IYTEW5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7RSNVY#issuecomment-534980311>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABPAMXL44TH77LUDLPQOJPDQLNELZANCNFSM4IYTEW5A>
.
--
Jean Chapelle
|
It took me a while, but I think I've finally got it properly invalidating AWS cloudfront with some pretty minor tweaks (mainly this guide and getting the deployment to set the proper cache-control on sw.js when it's not hosted at the root). But I'm not even entirely sure that's the right approach. Would it make sense to handle updates in a saga and how would the offline-plugin support that. I'm thinking some simple banner "A new version is available, click here to reload". Would love to hear other approaches! |
@julienben @jchapelle and others... I really have NO TROUBLES with the Offline App feature. It's the feature i am currently using the most. I publish a new version (i am not even updating package.json version) and website is updated as expected either when
The only time it isnt gets updated is when user nagivates in the app which isn't a problem at all. So what are you guys trying to achieve ? Aren't these fine ? My config:
Are you trying these things ? |
We also disabled the offlinePlugin due to cache issues. |
So I finally got a chance to work on this and @Can-Sahin 's suggestions worked perfectly, I can reload the tab and the new version presents as desired!! It seems like |
I can also make the pull request. I was actually waiting for someone to try my settings to verify or to feedback. @julienben do you think a quick pull request I do for this until workbox plugin? So that v5 could provide better offline plugin experience. |
I think this would be a nontrivial inclusion into v5. Honestly I don't think we can claim "offline first" in the features the way it is currently delivered, since it simply doesn't do the thing that people are naturally expecting. @Can-Sahin , if you make a PR I'm happy to do another test of that! |
Also, @Can-Sahin , can |
@t3db0t I dont know for now. Service worker needs to request sw.js and other files from server again for that while you are navigating in the application. So you have to trigger yourself. I haven't tried yet but Edit: It's mentioned here at the bottom |
@jeffyamada did you find a solution to force unregistering existing service workers?
We are also considering to removing the offline plugin. In addition to the minor problem with new versions of our app (only available on hard reload or after closing all tabs), we are specifically struggling with a domain name change. For new visitors the 301 redirect properly works but for returning visitors the service worker does not get or ignore it. Also open to keep offline support and migrate the service worker to the new domain (as described here) and any other solutions/workarounds/ideas - thanks! |
@tmfrnz sorry for the late reply, only just noticed you hit me. Yep, we've turned it off on several projects so far. We've been discussing it more lately for yet another project and from what I understand the biggest thing we need is for it to NOT cache index.html, which would allow us to then have the fresh css/js loaded. Unfortunately we just haven't had the time to figure out how to configure it to avoid index.html (or even completely confirm that it's caching index.html?) |
Thank you @jeffyamada for getting back to me. What would be the best way (or any way) to disable and remove the offline plugin AFTER it already being deployed to and running in users' browsers? Thanks |
@tmfrnz that's what makes this issue so painful - there's no way we found to update it. It seems they time out after a couple weeks for people who have visited previously though. Essentially index.html caching means that everything else was cached as well:( |
Oh, I should probably add that you can loop through and unregister the service workers - like this: https://stackoverflow.com/questions/33704791/how-do-i-uninstall-a-service-worker |
Thanks! I'll have a go at unregistering those SWs and disable the offline support. Planning a bigger update and have experienced some blank screens on our dev site (due to inconsistent resources being cached by the SW) so fingers crossed we can make it work. Only wish offline support was disabled by default and a warning included about enabling it... Thanks again - much appreciated |
This seems to have worked for me. |
Great ! I don't have time to test these right know but I'm pretty sure you all found the solution ;-) |
Here's my config for using the default responseStrategy of 'cache-first'. |
Looks like |
Describe the solution you'd like
Guys, it seems the offline configuration of the boilerplate is not working as expected :
Could you please describe the behaviour you would like ? From that point, I can implement a new version of sw or contact the backers of OfflinePlugin to find the proper configuration (which I already began to do in this this, this and this.
Here is my personal feeling :
The text was updated successfully, but these errors were encountered: