buda-base / public-digital-library

http://library.bdrc.io
5 stars 6 forks source link

app broken in some cases after an upgrade #526

Open eroux opened 3 years ago

eroux commented 3 years ago

I'm not sure why, but sometimes (even when the cache is off), the browser doesn't seem to want to update the main html, which leads to the wrong .js file being called and not found... This happened to TD recently, here's a screenshot:

Screen Shot 2021-07-22 at 11 20 20 AM

at the time of the screenshot, the javascript bundle already changed name (to main.64a5670b.chunk.js). It doesn't make an awful lot of sense since nginx should detect that the files changed and change their Etag header (at the time of the screenshot W/"60f93b11-bd8")... difficult to debug because difficult to reproduce but let's track it

eroux commented 3 years ago

here's a screenshot of the headers of the broken app, which show a different Etag:

Screen Shot 2021-07-22 at 12 05 46 PM
eroux commented 3 years ago

I wonder if it might come from the (from service worker) thing... (see here ?)

eroux commented 2 years ago

It still happens that after a deploy some users are left with a blank page and need to reload the page with no cache because the name of the js file changed. I'm wondering if we could use the onerror= tag on the <script> tags (as indicated in this answer) ? ideally it would:

berger-n commented 2 years ago

good idea, thanks! deployed something like that here and changed index.html to point to wrong js file: http://library-dev.bdrc.io/

Screenshot_20220202_134015

now the thing is forcing full page reload may not be as reliable as hoped: https://developer.mozilla.org/fr/docs/Web/API/Location/reload#location.reload_na_pas_de_param%C3%A8tre

(tested locally with serve on /prod, when I manually force reload it shows the error message, but when it reloads itself it shows previous version)

so best I can think of is adding a link to https://en.wikipedia.org/wiki/Wikipedia:Bypass_your_cache available in Chinese as well (but not in Tibetan...)

eroux commented 2 years ago

thanks! can we replace with something like:

Sorry, the website encountered an error while loading, please reload the page with ctrl + shift + r on PC or Apple + shift + r on Mac

it will be very helpful, thanks!

berger-n commented 2 years ago

done, added a bit of css: http://library-dev.bdrc.io/

Screenshot_20220202_151800

eroux commented 2 years ago

ah, that's better thanks!