Merge pull request #1065 from marcchehab/patch-1

Fix React warning about unique "key" prop
This commit is contained in:
Rufus Pollock 2024-03-29 14:56:38 +01:00 committed by GitHub
commit d898b5a833
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -46,8 +46,8 @@ export const SiteToc: React.FC<Props> = ({ currentPath, nav }) => {
return (
<nav data-testid="lhs-sidebar" className="flex flex-col space-y-3 text-sm">
{sortNavGroupChildren(nav).map((n) => (
<NavComponent item={n} isActive={false} />
{sortNavGroupChildren(nav).map((n, index) => (
<NavComponent key={index} item={n} isActive={false} />
))}
</nav>
);
@ -96,8 +96,8 @@ const NavComponent: React.FC<{
leaveTo="transform scale-95 opacity-0"
>
<Disclosure.Panel className="flex flex-col space-y-3 pl-5 mt-3">
{sortNavGroupChildren(item.children).map((subItem) => (
<NavComponent item={subItem} isActive={false} />
{sortNavGroupChildren(item.children).map((subItem, index) => (
<NavComponent key={index} item={subItem} isActive={false} />
))}
</Disclosure.Panel>
</Transition>