router
router copied to clipboard
`defaultErrorComponent` default does not behave as expected
Which project does this relate to?
Router
Describe the bug
According to the docs/jsdoc, defaultErrorComponent defaults to ErrorComponent, but it doesn't behave as if ErrorComponent is set.
const router = createRouter({
routeTree,
defaultErrorComponent: ErrorComponent
});
Your Example Website or App
https://stackblitz.com/edit/github-svg4st?file=src%2Fmain.tsx,src%2Froutes%2Findex.tsx
Steps to Reproduce the Bug or Issue
- Click on the
Crash the pagebutton - Notice that the outlet renders the error component
- Comment out the
defaultErrorComponentline inmain.tsx - Crash the page again
- Notice that the whole page is now replaced with the error component, the navigation links are gone
Expected behavior
defaultErrorComponent should behave as documented, i.e. it should behave as if ErrorComponent is set.
In comparison, defaultNotFoundComponent works as expected in either case. 👍
Screenshots or Videos
Platform
- OS: Windows
- Browser: Chrome
- Version: 1.57.13
Additional context
No response