Skip to content
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

Add lazyWithRetry utility #180

Merged
merged 1 commit into from
May 15, 2024
Merged

Add lazyWithRetry utility #180

merged 1 commit into from
May 15, 2024

Conversation

ukorvl
Copy link
Member

@ukorvl ukorvl commented May 14, 2024

This diff adds lazyWithRetry utility function to mitigate loading chunks errors.

We can see this error when try to dynamically load module, for example using react router with React.lazy.

Typically, every module has hash in its name like [name].[hash].js.
This hash helps to understand that module was updated.

We do the above to make the browsers aware of the code change, that is good for the times when users are not online and will come back after we deploy a new version while online users still are imminent to the issue we’ve proposed.

If the page is stale for some period of time, and files are updated on the server, the name of the module actually is getting outdated. Frontend knows about module.xxx.js, but we already have module.yyy.js. When user tries to navigate the route wit that module, the error will be thrown.

@ukorvl ukorvl requested a review from KlonD90 May 14, 2024 12:02
@ukorvl ukorvl self-assigned this May 14, 2024
@ukorvl ukorvl merged commit adffcaa into master May 15, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants