Skip to content

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.

2 participants