Skip to content

Commit f289f99

Browse files
CopilotIlyaKhD
andauthored
fix: inline useMemo callback in SideNavigationMenu templates to satisfy React Compiler ESLint rule
Agent-Logs-Url: https://github.com/DevExpress/devextreme-cli/sessions/a1557837-1895-4f59-997a-2f481cf5ab15 Co-authored-by: IlyaKhD <14272298+IlyaKhD@users.noreply.github.com>
1 parent 0641b34 commit f289f99

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

packages/devextreme-cli/src/templates/nextjs/application/src/components/side-navigation-menu/SideNavigationMenu.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ export default function SideNavigationMenu(props<%=#isTypeScript%>: React.PropsW
2020

2121
const theme = useContext(ThemeContext);
2222
const { isLarge } = useScreenSize();
23-
function normalizePath () {
24-
return navigation.map((item) => (
25-
{ ...item, expanded: isLarge, path: item.path && !(/^\//.test(item.path)) ? `/${item.path}` : item.path }
26-
))
27-
}
28-
2923
const items = useMemo(
30-
normalizePath,
24+
() => navigation.map((item) => (
25+
{ ...item, expanded: isLarge, path: item.path && !(/^\//.test(item.path)) ? `/${item.path}` : item.path }
26+
)),
3127
// eslint-disable-next-line react-hooks/exhaustive-deps
3228
[]
3329
);

packages/devextreme-cli/src/templates/react/application/src/components/side-navigation-menu/SideNavigationMenu.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@ export default function SideNavigationMenu(props<%=#isTypeScript%>: React.PropsW
2020

2121
const theme = useContext(ThemeContext);
2222
const { isLarge } = useScreenSize();
23-
function normalizePath () {
24-
return navigation.map((item) => (
25-
{ ...item, expanded: isLarge, path: item.path && !(/^\//.test(item.path)) ? `/${item.path}` : item.path }
26-
))
27-
}
28-
2923
const items = useMemo(
30-
normalizePath,
24+
() => navigation.map((item) => (
25+
{ ...item, expanded: isLarge, path: item.path && !(/^\//.test(item.path)) ? `/${item.path}` : item.path }
26+
)),
3127
// eslint-disable-next-line react-hooks/exhaustive-deps
3228
[]
3329
);

0 commit comments

Comments
 (0)