My web app renders asynchronously via javascript. The issue is that the browser caches a version of the page and then doesn't update the cache when I manipulate the DOM. Then when I click the back or forward buttons, the browser loads the cached version of the webpage, which is not the final version.
My patch is to force a page reload whenever a popstate event fires.
window.addEventListener('popstate', () => window.location.reload())
But that solution slows down the page load significantly.
I am wondering if there is a way to force a browser cache update whenever I manipulate the DOM. Something like:
window.location.forceCacheUpdate()
I want to be able to update the cache without reloading the entire page.