-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
addRoute does not add new routes as children #600
Comments
The What would be the use case for having |
Hey @posva, what a fast reply! Thanks for that. I am trying to build a sub navigation for routes with children and the easiest why would be to iterate over that exact children array I guessed. But it breaks as soon as I am adding routes dynamically, which is too bad. In some other project we wanted to be able to build a dynamic page builder and be able to persist the current user settings, for which we are using Any suggestions from your side? :) Best, |
What do you mean by sub navigation? |
Like a multi level navigation? Like the one shown here for example: https://www.w3schools.com/howto/howto_css_subnav.asp Can you check my |
You realize that even if |
What do you think? |
I think building a navbar shouldn't be part of the router code, it's application code that should format the routes exported by the router. I would rather see a For example, it's not clear if only original records should be pointed to inside |
@posva thank you very much for your time and feedback. Very much appreciated :). I will check your link and suggestions. |
Version
4.0.0-rc.3
Reproduction link
https://codesandbox.io/s/bitter-dew-ie45g?file=/src/router/index.ts
Steps to reproduce
Check the link and open the console to see the output of all registered routes. Check the last object's children.
What is expected?
All dynamically added routes should be added to the Preview's route children array. Since I am adding them to that exact route.
What is actually happening?
Preview-First and Preview-Second are not getting added as child but as root routes with the path pointing to the correct location.
The children array of Preview does contain only the one added in the beginning via the routes array.
The text was updated successfully, but these errors were encountered: