
React JS Code delivery - crookie
How do you make sure that your users are using the latest React JS code ? Some of my users do not close their tabs or browser window and they keep on using the old code. How to make sure that does not happen ? TIA
======
whatnotests
Google JavaScript cache busting.

Some tools, like Ruby on Rails will compute a unique signature as part of the
file name for each file when you prepare for deployment to production. This
helps ensure that every time you deploy new code, only the new version of
everything will be linked to.

If you use WebPack it may help you out quite a bit. Take a look here
[https://medium.com/powerspace-engineering/how-to-cache-
busti...](https://medium.com/powerspace-engineering/how-to-cache-busting-with-
webpack-5131b4af8826)

~~~
crookie
It is not actually about cache busting. I generate unique filenames for all my
JS files and other assets when they update, but the client browser gets to
know about them when they download index file, untill then they dont need
anything else. So, there are some users who do not refresh browser ever and
keep on using the same tab always. I want them to always use the latest index
file and thus the latest code. Is there a way to do it just using cache ?

~~~
janesconference
(In reality, you should ask yourself why your users are behaving like that:
don't they shut down their computer ever? Don't they like updates? That's
pretty odd behaviour)

~~~
jivings
Is it that odd? How often do you close the tab containing your email client
for example? I literally only ever close mine by accident, and there are a lot
of environments in which machines are rarely rebooted.

~~~
crookie
Well, it's not that odd, but refreshing the app after doing some check using
API's is the only way ?

------
janesconference
Take a look at: [https://medium.com/releasepage/how-to-update-your-running-
we...](https://medium.com/releasepage/how-to-update-your-running-web-app-
babb03db4f7d)

~~~
janesconference
Git repo here:
[https://github.com/releasepage/reload.js](https://github.com/releasepage/reload.js)

~~~
crookie
Thanks, will look into it . :)

