-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loading chunk XYZ failed #5750
Comments
A quick and easy solution is to actually leave old |
@ianschmitz Yea, I thought about that of course, but it adds extra overhead when preparing a release. How old assets should I keep there? When to remove the old ones or even recognize which are the old one in the mess of like 30+ chunks :) |
The default behavior of |
/cc @jeffposnick for visibility |
Um, isn't |
The thing about lazy-loading failures is that they can be triggered by using a service worker with I think a great course of action is for the folks who provide lazy-loading runtime code are upfront about these failure scenarios in their docs, and document patterns to work around them. The brute-force approach would be to force-reload the entire web page when there's a failure to lazy-load something. It looks like https://www.npmjs.com/package/react-lazy has some events you could hook into to detect failures, and respond appropriately. |
Oh, derp. Sorry @FredyC I totally misread this. I thought you were using the service worker -- your first sentence clearly states otherwise. 😅 I think this is a perfect scenario for turning on the service worker (because it solves this problem). |
Alright, thank both of you for the insight. I will probably try some skeleton app first and see if it behaves the way I need. In case it won't, I'll reopen this. |
There is a similar issue #4152, but the main difference is that I am not using a service worker just yet and it's a static deployment, no backend serving the content. This error did not make sense to me for a long time as I was unable to reproduce it, but yesterday it finally happened.
The scenario is quite a simple, there is a deployed app using code splitting (and
React.lazy
) which is loaded into browser except that some chunks are not yet loaded because they weren't needed before. If we deploy a new version later and suddenly user decides to go into the part of the app he wasn't before, it is looking for an older chunk that's not already there and 💥I am wondering what is the proper solution to this. If there would be some way how to catch that error, I could force reload the app which ultimately is what needs to happen I suppose.
Honestly, I am a bit scared of registering service worker. The app is still heavy under development, but it's already in a production. Sadly there is nothing like release calendar on the team and it's not unusual to have 1-5 deployments to a production per week 🙄. Sometimes it's more or less a critical fix that should be delivered to customer ASAP. Is there some strategy to essentially detect that new version has been deployed and force the service worker to reload?
The text was updated successfully, but these errors were encountered: