Every time that a new deploy is made to production the client needs to force a refresh and clear cache with ctrl shift r to updated the UI, the project was made with Create-React-App. Is there any kind of config I'm missing?
CodePudding user response:
add meta tags inside the head tag to make sure that the content of the page isn’t cached.
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>
CodePudding user response:
Try this one, maybe you need cache control
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>
OR read this one https://webpack.js.org/guides/caching/
CodePudding user response:
Which version of CRA are you using? If it's caused due to ServiceWorker then you should disable the ServiceWorker.
import { unregister } from './registerServiceWorker';
unregister();
CodePudding user response:
Your src/index.js file should look like this
import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/App';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
serviceWorker.register();
Just change the
serviceWorker.register();
For
serviceWorker.unregister();