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

feat: retry chunk errors #331

Draft
wants to merge 2 commits into
base: feat/routeprogressbar
Choose a base branch
from

Conversation

Birkbjo
Copy link
Member

@Birkbjo Birkbjo commented May 22, 2023

This makes it possible for the user to "retry" when a chunk fails to load. This should hopefully be a pretty rare occurrence so I'm not sure if this is actually needed, but I wanted to investigate the possibility of doing this.

The implementation seems a bit "hacky", since we force react-router to remount by recreating the router. But from my experimentation and research, there doesn't seem to be a way to "reload" / retry the lazy function of a Route once it (or ErrorElement) has mounted. Another approach would be to programatically "retry" by running the import promise again, however then we can't show a spinner or a fallback component in the meantime.

Test

  • Open network tab in developer console
  • Navigate to the data element route
  • Block the data element chunk
  • Reload the page, and see that the error message with a retry button appears.
  • Click retry button and verify that it fails again
  • Remove chunk from blocked requests
  • Click retry, and the data element component should render

@Birkbjo Birkbjo changed the base branch from pr-323-technical-dept to feat/routeprogressbar May 22, 2023 11:25
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.

1 participant