How to recover from failure in switching lazy loading routes? #1864
-
What problem is this solvingWhen use lazy loading routing the new version is redeployed in the background, switching to lazy loading routing on the current browsing page will fail (the routing page is not found). How to capture this error and display it to inform the user that they need to refresh the page to load the latest version? I know it can be solved this way: import ErrorBoundary from './ErrorBoundary.vue'
const Page = () => import('./pages/xxx.vue').catch(err => ErrorBoundary) But it's not the optimal solution. Proposed solutionThe routing library supports this error capture definition error recover. Describe alternatives you've consideredNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
use the |
Beta Was this translation helpful? Give feedback.
use the
router.onError()
hook to detect these errors and handle it the way you prefer, e.g. reloading the page