-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
routeConfig array breaks with nested children, unless an empty object is provided #657
Comments
This was a breaking change that was added in v0.4.0 in #217. The idea is that, without this behavior, it was impossible to make This is the same between both JSX route configs and object route configs. Does that make sense? Was the issue that the release notes didn't describe clearly enough what this change was? |
Thanks for the answer. The fact that an empty object is required is not really mentioned and also all the examples of Definitely not a problem when using JSX given EDIT: if the empty object is now a requirement, why not processing the received array of object within the library to add it rather than forcing users to have a breaking requirement? |
To be clear, <Route path="foo">
<Route path="bar" />
</Route> to <Route path="foo">
<Route />
<Route path="bar" />
</Route> Assuming we're talking about the same thing here. |
You're absolutely right. Sorry for the confusion on this point; good to hear that the behaviour of the library is consistent between the JSX and the array of objects route config. I still believe that if you are using array of objects it would be quite odd having to add an empty object to your children array. In this case I guess the only action out of this ticket would be to update the README to make sure the empty children is documented in your examples. |
Hi @taion,
I have recently upgraded to found 0.4.9 and bumped into quite an annoying issue.
I suppose most of people create a router by using the JSX route config which still works perfectly fine.
However when using the routeConfig array of objects this no longer works as documented and I'm not able to navigate through routes that have a children.
I noticed that when using the JSX routes, makeRouteConfig will prepend an empty object to all the children routes.
The issue lies here, routeConfig array now expects the empty object to be defined when you have a children; most likely to cater for the scenario where you want to render a component on the children without the need of a subpath; f.i. on the top level route as follow:
To summarise as per documentation this is how we're supposed to build the routeConfig array of objects:
However the above won't allow navigation through children whilst instead adding an empty object to the children array will fix this issue; as below:
I believe this wasn't an intentional breaking change as is not documented, and I'm not sure it would make much sense, so should probably be classified as a bug.
Any chance you can issue a patch for this?
The text was updated successfully, but these errors were encountered: