You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This looks fine for now, but when I go to /admin/companies-management/view-companies/1/view-branches the generated breadcrumb items becomes
// Matches
[
{
"id": "__root__",
"routeId": "__root__",
"params": { "companyId": "1" },
"pathname": "/",
"fullPath": "/",
...other
},
{
"id": "/admin",
"routeId": "/admin",
"params": { "companyId": "1" },
"pathname": "/admin",
"fullPath": "/admin",
...other
},
{
"id": "/admin/companies-management/view-companies/1/view-branches",
"routeId": "/admin/companies-management/view-companies/$companyId/view-branches",
"params": { "companyId": "1" },
"pathname": "/admin/companies-management/view-companies/1/view-branches",
"fullPath": "/admin/companies-management/view-companies/$companyId/view-branches",
...other
}
]
// Generated Breadcrumb Items
[
{
"name": "admin",
"urlPath": "/admin",
"isClickable": true// This should be true
},
{
"name": "companies-management",
"urlPath": "/admin/companies-management",
"isClickable": false
},
{
"name": "view-companies",
"urlPath": "/admin/companies-management/view-companies",
"isClickable": false// This should be true since I defined a page for this
},
{
"name": "1",
"urlPath": "/admin/companies-management/view-companies/1",
"isClickable": false// This should be false since I did not define a page for this
},
{
"name": "view-branches",
"urlPath": "/admin/companies-management/view-companies/1/view-branches",
"isClickable": true
}
]
How do I ensure that only paths corresponding to valid pages are clickable in the breadcrumbs? Is there a better way of doing this? Thank you for help 😇🙏🏽
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am building a breadcrumb component where I want only those paths that have valid pages to be clickable.
Route Definitions
Here’s my route definition:
Here’s the breadcrumb logic I am currently using:
Example Scenario
I am currently at this path:
/admin/companies-management/view-companies
This looks fine for now, but when I go to
/admin/companies-management/view-companies/1/view-branches
the generated breadcrumb items becomesHow do I ensure that only paths corresponding to valid pages are clickable in the breadcrumbs? Is there a better way of doing this? Thank you for help 😇🙏🏽
Beta Was this translation helpful? Give feedback.
All reactions