Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

367
Views
Best way to avoid Cache Busting ( Need to Hard refresh ) in a react js web application?

i have a react js based web app the problem is every time there is a new deployment it needs to do hard refresh to see the change implemented which is very irritating to the client i could see only two options to fix this

Client Side

Modifying external resources by appending some random stuff like "script.js?ts=timestring"

OR

Server Side

Using Web Pack to create a bundle and modifying the file name from server side by some random stuff

Now is there any other way to do this , also in client side solution i am trying to achieve this

by re appending the loaded scripts to the loading page in index.html

Array.from(document.querySelectorAll('script')).forEach(s => {
                 
                    var fileref = document.createElement('script');
                    fileref.setAttribute("type", "text/javascript");
                    fileref.setAttribute("src", s.src + "?ts=" + Date.now().toString());
                    document.getElementsByTagName("head")[0].appendChild(fileref);
                }  

but this solution is not working because appending the script again causing app to re-render resulting in blank page

please let me know what better can i do in both the cases , whether handle it client side of server side by webpack

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!