Skip to content

Commit

Permalink
fix(fe): 🐛 resolve uniq key props in list
Browse files Browse the repository at this point in the history
  • Loading branch information
lehuygiang28 committed Jul 2, 2024
1 parent e631264 commit b749d50
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions apps/fe/src/components/themed-layout/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { PropsWithChildren, useContext } from 'react';
import { Fragment, PropsWithChildren, useContext } from 'react';
import Image from 'next/image';
import Link from 'next/link';
import { Layout, Typography } from 'antd';
Expand Down Expand Up @@ -34,12 +34,12 @@ function CustomSider({ mode, user }: { mode: string; user: UserDto }) {
render={({ items, logout, collapsed }) => {
return (
<>
{items.map((item) => {
{items.map((item, index) => {
if (item.key.includes('admin') && user?.role !== UserRoleEnum.Admin) {
return <></>;
return <Fragment key={`${item.key}_${index}`}></Fragment>;
}

return item;
return <Fragment key={`${item.key}_${index}`}>{item}</Fragment>;
})}
{logout}
{collapsed}
Expand Down Expand Up @@ -75,17 +75,8 @@ export function ThemedLayout({ children }: PropsWithChildren) {
return (
<ThemedLayoutV2
Header={() => <Header user={user} sticky />}
Sider={() => (
<>
<CustomSider mode={mode} user={user} />
</>
)}
dashboard
Footer={() => (
<>
<CustomFooter mode={mode} />
</>
)}
Sider={() => <CustomSider mode={mode} user={user} />}
Footer={() => <CustomFooter mode={mode} />}
>
{children}
</ThemedLayoutV2>
Expand Down

0 comments on commit b749d50

Please sign in to comment.