Skip to content

Commit

Permalink
Merge pull request #74 from alleyinteractive/feature/react-fixes
Browse files Browse the repository at this point in the history
Add keys when rendering lists
  • Loading branch information
renatonascalves authored Oct 27, 2023
2 parents cdfe4e5 + 76864c6 commit 49873cd
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions blocks/query/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import {
TextControl,
} from '@wordpress/components';
import { useSelect } from '@wordpress/data';
import { createInterpolateElement, useEffect, useState } from '@wordpress/element';
import {
Fragment,
createInterpolateElement,
useEffect,
useState,
} from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';
import { addQueryArgs } from '@wordpress/url';

Expand Down Expand Up @@ -303,10 +308,13 @@ export default function Edit({
className="manual-posts"
>
{manualPosts.map((_post, index) => (
<PanelRow className={classnames(
'manual-posts__container',
{ 'manual-posts__container--selected': manualPosts[index] },
)}
<PanelRow
// eslint-disable-next-line react/no-array-index-key
key={index}
className={classnames(
'manual-posts__container',
{ 'manual-posts__container--selected': manualPosts[index] },
)}
>
<span className="manual-posts__counter">{index + 1}</span>
<PostPicker
Expand All @@ -332,7 +340,7 @@ export default function Edit({
/>
{Object.keys(availableTaxonomies).length > 0 ? (
allowedTaxonomies.map((taxonomy) => (
<>
<Fragment key={taxonomy}>
{ /* @ts-ignore */ }
<TermSelector
label={availableTaxonomies[taxonomy].name || taxonomy}
Expand All @@ -354,7 +362,7 @@ export default function Edit({
/>
) : null}
<hr />
</>
</Fragment>
))
) : null}
{taxCount > 1 ? (
Expand Down

0 comments on commit 49873cd

Please sign in to comment.