Navigation breaks upon unrelated error #2435
-
Hello there, We are migrating an app from webpack to vite, and while doing so I found a strange behavior. It seems that with our new version, an error (like component script execution) will freeze the navigation. You can find a reproduction here Home page is fine, Sync page has a div with a class that tries to access an item on undefined. Once arriving on the sync page and the error triggers, the Home page (with "Home view" message) is can not be accessed anymore (though the url will change). Is this intended ? For our project it can be inconvenient as multiple teams work on the same codebase and sometimes an error (that doesn't necessarily breaks the page in terms of business, just a component won't display for instance) and that error can't be fixed right away, but not being able to do navigation anymore is a bit inconvenient. I don't know if it's worth mentionning, but removing the key in the RouterView changes the behavior a bit, the error preventing navigation will not re-appear upon trying to navigate again. Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
This wasn't intended but was part of the new behavior of RouterView with Vue 3. In practice, you are not expected to deploy applications with these kind of errors as they mean the page will always break when loaded. You can catch them with an error handler: const app = createApp(App)
app.config.errorHandler = (e) => {
console.log('OH NO', e)
} |
Beta Was this translation helpful? Give feedback.
This wasn't intended but was part of the new behavior of RouterView with Vue 3. In practice, you are not expected to deploy applications with these kind of errors as they mean the page will always break when loaded. You can catch them with an error handler: