Skip to content
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

CustomRoutes not displaying in sidebar #9383

Closed
wallacer opened this issue Oct 23, 2023 · 4 comments
Closed

CustomRoutes not displaying in sidebar #9383

wallacer opened this issue Oct 23, 2023 · 4 comments

Comments

@wallacer
Copy link

wallacer commented Oct 23, 2023

Here is my codesandbox where I created a SimpleCard component which just renders <h1>Hello World!</h1> inside a Card. I've not passed noLayout - and my component includes a Title component, so based on the docs.

What you were expecting:
I expect my custom route for my simple card component to appear in the sidebar, with the title I've used - "Hello".

What happened instead:
Nothing changes in the sidebar, no matter whether the CustomRoute is used or not.

Steps to reproduce:
Use a CustomRoutes component, with or without a Title component in it, and without passing noLayout.

Related code:
https://codesandbox.io/p/sandbox/condescending-booth-tqhch4

Environment

  • React-admin version: 4.15.1
  • Last version that did not exhibit the issue (if applicable):
  • React version: 18.2
  • Browser:
  • Stack trace (in case of a JS error):
@slax57
Copy link
Contributor

slax57 commented Oct 26, 2023

Hi @wallacer

Custom Routes don't appear automatically in the menu, as we wouldn't know what label to use, or what to do with nested routes.

You need to use a custom Menu to show them.

@slax57 slax57 closed this as completed Oct 26, 2023
@fzaninotto
Copy link
Member

@wallacer
Copy link
Author

Got it, sorry about that. I was thinking the Title component handled that But I think I just mis-read app bar as side bar.

FWIW the other slightly confusing piece of documentation was noLayout. "By default, custom routes render within the application layout (with the menu and the app bar)".

I had already landed on creating a custom Menu, but really appreciate the clarification here :)

@fzaninotto
Copy link
Member

You've got a point: the CustomRoutes doc could be improved. I made a PR for that: #9404.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants