Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keys when rendering lists #74

Merged
merged 5 commits into from
Oct 27, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions blocks/query/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
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 @@ -281,10 +286,11 @@
className="manual-posts"
>
{manualPosts.map((_post, index) => (
<PanelRow className={classnames(

Check failure on line 289 in blocks/query/edit.tsx

View workflow job for this annotation

GitHub Actions / node-tests / Install, build, and test

Property should be placed on a new line
'manual-posts__container',
{ 'manual-posts__container--selected': manualPosts[index] },
)}
key={index}

Check failure on line 293 in blocks/query/edit.tsx

View workflow job for this annotation

GitHub Actions / node-tests / Install, build, and test

Expected indentation of 14 space characters but found 12

Check failure on line 293 in blocks/query/edit.tsx

View workflow job for this annotation

GitHub Actions / node-tests / Install, build, and test

Do not use Array index in keys
>
<span className="manual-posts__counter">{index + 1}</span>
<PostPicker
Expand All @@ -310,7 +316,7 @@
/>
{Object.keys(availableTaxonomies).length > 0 ? (
allowedTaxonomies.map((taxonomy) => (
<>
<Fragment key={taxonomy}>
{ /* @ts-ignore */ }
<TermSelector
label={availableTaxonomies[taxonomy].name || taxonomy}
Expand All @@ -319,7 +325,7 @@
onSelect={(newCategories: Term[]) => setTerms(taxonomy, newCategories)}
multiple
/>
</>
</Fragment>
))
) : null}
<TextControl
Expand Down
Loading