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

Fix warnings in Menu #7931

Merged
merged 1 commit into from
Jul 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 23 additions & 25 deletions packages/ra-ui-materialui/src/layout/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,29 @@ export const Menu = (props: MenuProps) => {
const createPath = useCreatePath();
const {
hasDashboard,
children = (
<>
{hasDashboard && <DashboardMenuItem />}
{Object.keys(resources)
.filter(name => resources[name].hasList)
.map(name => (
<MenuItemLink
key={name}
to={createPath({
resource: name,
type: 'list',
})}
state={{ _scrollToTop: true }}
primaryText={getResourceLabel(name, 2)}
leftIcon={
resources[name].icon ? (
createElement(resources[name].icon)
) : (
<DefaultIcon />
)
}
/>
))}
</>
),
children = [
hasDashboard ? <DashboardMenuItem /> : null,
...Object.keys(resources)
.filter(name => resources[name].hasList)
.map(name => (
<MenuItemLink
key={name}
to={createPath({
resource: name,
type: 'list',
})}
state={{ _scrollToTop: true }}
primaryText={getResourceLabel(name, 2)}
leftIcon={
resources[name].icon ? (
createElement(resources[name].icon)
) : (
<DefaultIcon />
)
}
/>
)),
],
className,
...rest
} = props;
Expand Down