mirror of
https://github.com/duckietm/Nitro-Cool-UI.git
synced 2025-06-21 22:36:58 +00:00
Fix Error in catalog (Encountered two children with the same key, -1
.)
This commit is contained in:
parent
bfbc2109cd
commit
3e346f3ac6
@ -71,18 +71,22 @@ export const CatalogView: FC<{}> = props =>
|
|||||||
{ isVisible &&
|
{ isVisible &&
|
||||||
<NitroCardView uniqueKey="catalog" className="nitro-catalog" style={ GetConfiguration('catalog.headers') ? { width: 710 } : {} }>
|
<NitroCardView uniqueKey="catalog" className="nitro-catalog" style={ GetConfiguration('catalog.headers') ? { width: 710 } : {} }>
|
||||||
<NitroCardHeaderView headerText={ LocalizeText('catalog.title') } onCloseClick={ event => setIsVisible(false) } />
|
<NitroCardHeaderView headerText={ LocalizeText('catalog.title') } onCloseClick={ event => setIsVisible(false) } />
|
||||||
<NitroCardTabsView>
|
<NitroCardTabsView subClassName="w-100">
|
||||||
{ rootNode && (rootNode.children.length > 0) && rootNode.children.map(child =>
|
{rootNode &&
|
||||||
{
|
rootNode.children.length > 0 &&
|
||||||
|
rootNode.children.map((child, index) => {
|
||||||
if (!child.isVisible) return null;
|
if (!child.isVisible) return null;
|
||||||
|
// Generate a unique key using the index of the map function
|
||||||
|
const uniqueKey = `${child.pageId}-${index}`;
|
||||||
return (
|
return (
|
||||||
<NitroCardTabsItemView key={ child.pageId } isActive={ child.isActive } onClick={ event =>
|
<NitroCardTabsItemView
|
||||||
{
|
key={uniqueKey}
|
||||||
|
isActive={child.isActive}
|
||||||
|
onClick={(event) => {
|
||||||
if (searchResult) setSearchResult(null);
|
if (searchResult) setSearchResult(null);
|
||||||
|
|
||||||
activateNode(child);
|
activateNode(child);
|
||||||
} } >
|
}}
|
||||||
|
>
|
||||||
<Flex gap={GetConfiguration('catalog.tab.icons') ? 1 : 0} alignItems="center">
|
<Flex gap={GetConfiguration('catalog.tab.icons') ? 1 : 0} alignItems="center">
|
||||||
{GetConfiguration('catalog.tab.icons') && <CatalogIconView icon={child.iconId} />}
|
{GetConfiguration('catalog.tab.icons') && <CatalogIconView icon={child.iconId} />}
|
||||||
{child.localization}
|
{child.localization}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user