-
-
Notifications
You must be signed in to change notification settings - Fork 273
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
[AppProvider] Create basic router adapters #3638
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really great, looks like there wasn't a need to use hooks after all.
We're just gonna need to fix the API docs for the AppProvider
, and we can also use this local state router in the examples here https://deploy-preview-3638--mui-toolpad-docs.netlify.app/toolpad/core/react-dashboard-layout/, but none of that has to be done in this PR, I can even take care of those.
I can test them on the the playgrounds too, but it would probably be better to merge this first as you already unified the Next.js app providers.
About the playground tweaks, yeah I was changing them so that the home page is the dashboard already, I guess that makes more sense and we probably don't need a /dashboard
route?
@@ -157,6 +147,17 @@ function DashboardSidebarSubNavigation({ | |||
[], | |||
); | |||
|
|||
const handleLinkClick = React.useMemo(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not a .useCallback
here? Not saying it's wrong, just curious as it's what I would use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useCallback
always returns a function, and here I want handleLinkClick
it to be able to be undefined
as well
@@ -30,11 +48,14 @@ export type NavigationItem = NavigationPageItem | NavigationSubheaderItem | Navi | |||
|
|||
export type Navigation = NavigationItem[]; | |||
|
|||
// TODO: hide these contexts from public API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to export the contexts in AppProvider/index
, if was probably just an oversight from me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we can just move the to their own file.
Signed-off-by: Jan Potoms <2109932+Janpot@users.noreply.github.com>
@apedroferreira Basic router implementation as a starting point.
Some potential tweaks we could do to the playground:
toolpad-core-next
folder to justnextjs
and the plaground package toplayground-next
dashboard
folder to a(dashboard)
folder to remove that segment from the url