Busting SPA Chunk Cache for Active Users After a Deploy

It’s a common problem with single page apps (SPA): when a deployment finishes successfully after the user has loaded the app, they still use the old and cached version until they refresh the website.

This problem aggravates with async chunks. The app is split in parts and each part is only loaded on demand, like when a user navigates to a respective section. The user might be in one part of the app while a deploy process succeeds, then if they navigate to another part, the chunks they request will have been removed from the server by the build script. Problem: this causes loading errors.

We had the same issues with Hypefactors and Hype.News. Until we devised an elegant, yet simple solution to this problem.

Read the whole article on Medium