-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
Basename Not Included in href for Links in Left Navigation #4556
Comments
Hi, could you please share a reproduction / CodeSandbox or the specific configuration you're using for React Router and the I wonder if just including the |
I believe this will need to be part of the router adapter. the DashboardLayout should not need to know about the basepath. |
const router = createBrowserRouter(
[
{
Component: App,
children: [
{
path: "",
element: <Layout />,
children: [
{
path: "",
element: <Home />,
},
{
path: "question",
element: <QuestionList />,
},
{
path: "question/:qid",
element: <Question />,
},
{
path: "exam_paper",
element: <ExamPaperList />,
},
{
path: "exam_paper/:pid",
element: <ExamPaper />,
},
],
},
],
},
],
{
basename: "/question-bank",
}
);
const navigation: Navigation = [
{
title: 'Home',
icon: <DashboardIcon />
},
{
kind: 'divider'
},
{
kind: 'header',
title: 'Questions'
},
{
segment: 'question',
title: 'Questions',
icon: <DescriptionIcon />,
pattern: 'question{/:qid}*'
},
{
segment: 'exam_paper',
title: 'Exam Paper',
icon: <NewspaperIcon />,
pattern: 'exam_paper{/:pid}*'
}
];
I tried placing the |
Steps to reproduce
When a
basename
is added to React Router,thehref
in the left-side navigation does not include thebasename
.While everything works fine during regular navigation, the path is incorrect when opening links in a new window or tab.
e.g., right-click -> Open link in new tab
@toolpad/[email protected]
Current behavior
No response
Expected behavior
No response
Context
No response
Your environment
No response
Search keywords: navigation, routing, link, basename
The text was updated successfully, but these errors were encountered: