Skip to content

Commit

Permalink
frontend: Memoize SidebarItem component
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksandr Dubenko <[email protected]>
  • Loading branch information
sniok committed Dec 6, 2024
1 parent 048e2ab commit d0f04c7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions frontend/src/components/Sidebar/SidebarItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Collapse from '@mui/material/Collapse';
import List from '@mui/material/List';
import ListItem, { ListItemProps } from '@mui/material/ListItem';
import { useTheme } from '@mui/system';
import React from 'react';
import React, { memo } from 'react';
import { generatePath } from 'react-router';
import { createRouteURL, getRoute } from '../../lib/router';
import { getCluster, getClusterPrefixedPath } from '../../lib/util';
Expand All @@ -27,7 +27,7 @@ export interface SidebarItemProps extends ListItemProps, SidebarEntry {
hide?: boolean;
}

export default function SidebarItem(props: SidebarItemProps) {
const SidebarItem = memo((props: SidebarItemProps) => {
const {
label,
name,
Expand Down Expand Up @@ -248,4 +248,6 @@ export default function SidebarItem(props: SidebarItemProps) {
)}
</React.Fragment>
);
}
});

export default SidebarItem;

0 comments on commit d0f04c7

Please sign in to comment.