Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

353
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda