Rendering of ancestor routes broken on 0.4?
dmwallace opened this issue · 1 comments
Minimal reproducible example:
`import createBrowserRouter from 'found/lib/createBrowserRouter';
import React from 'react';
import ReactDOM from 'react-dom';
const routes = [
{
path: '/',
Component: (props) =>
/
{props.children}children: [
{
path: '/parent',
Component: (props) =>
/parent
{props.children}children: [
{
path: '/child',
Component: (props) =>
/child
}
]
}
],
},
]
const BrowserRouter = createBrowserRouter({ routeConfig: routes });
ReactDOM.render(, document.getElementById('root'));`
All routes render correctly on version 0.3.x, but on 0.4.x only /parent/child renders anything. /parent and / won't render as long as they have child routes. If you take the child routes out they render correctly.
This was an intentional change per https://github.com/4Catalyzer/found/releases/tag/v0.4.0 (#217), as it was otherwise not possible to get e.g. /parent
to not match.
If you still need a non-leaf route to match, just add some stub leaf child to it, e.g. just an empty object.