DEV Community

Discussion on: How to retry when React lazy fails

Collapse
 
aditya_2911 profile image
M ADITYA • Edited

Thumbs up for this post. But I have a question as to when you are loading this new chunk...
for example: after a new deployment on the server, you definitely would fetch the updated chunk with the retries, but what about the initial bundle thats already been fetched (that stale bundle wouldn't be updated with the new bundle deployed right?). This could potentially lead to problems such as the newly fetched chunk being incompatible with the old bundle, etc.

Collapse
 
0xdevalias profile image
Glenn 'devalias' Grant

I would suggest having a look at this blog and/or StackOverflow answer, as I feel they better describe the problem (and the 'why' of it), as well as providing some better solutions:

As Ricardo mentioned above in dev.to/maininfection/comment/727e this ChunkLoadError generally tends to happen when pushing new code, while the client's browser still has the old/outdated 'list of chunks' cached.