Small fix CatalogView

This will fix:

Warning: Encountered two children with the same key, -1. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.
This commit is contained in:
duckietm 2023-07-20 10:39:14 +02:00 committed by GitHub
parent aba4ddf2db
commit 77ecdf6b7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,12 +72,13 @@ export const CatalogView: FC<{}> = props =>
<NitroCardView uniqueKey="catalog" className="nitro-catalog" style={ GetConfiguration('catalog.headers') ? { width: 710 } : {} }>
<NitroCardHeaderView headerText={ LocalizeText('catalog.title') } onCloseClick={ event => setIsVisible(false) } />
<NitroCardTabsView>
{ rootNode && (rootNode.children.length > 0) && rootNode.children.map(child =>
{
{ rootNode && rootNode.children.length > 0 && rootNode.children.map((child, index) => {
if(!child.isVisible) return null;
// Generate a unique key using the index of the map function
const uniqueKey = `${child.pageId}-${index}`;
return (
<NitroCardTabsItemView key={ child.pageId } isActive={ child.isActive } onClick={ event =>
<NitroCardTabsItemView key={uniqueKey} isActive={child.isActive} onClick={(event) => {
{
if(searchResult) setSearchResult(null);