Skip to content

Commit

Permalink
Add triggerSearch prop to RelatedIncidents for dynamic rendering base…
Browse files Browse the repository at this point in the history
…d on input length
  • Loading branch information
clari182 committed Dec 26, 2024
1 parent ea76e44 commit 550dc71
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions site/gatsby-site/src/components/submissions/SubmissionForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,12 @@ const SubmissionForm = ({ onChange = null }) => {
btnDisabled={!!errors.url || !touched.url || parsingNews}
btnText={t('Fetch info')}
/>
<RelatedIncidents incident={values} setFieldValue={setFieldValue} columns={['byURL']} />
<RelatedIncidents
incident={values}
setFieldValue={setFieldValue}
columns={['byURL']}
triggerSearch={values['url']?.length}
/>

<TextInputGroup
name="title"
Expand All @@ -219,7 +224,12 @@ const SubmissionForm = ({ onChange = null }) => {
{...TextInputGroupProps}
/>

<RelatedIncidents incident={values} setFieldValue={setFieldValue} columns={['byAuthors']} />
<RelatedIncidents
incident={values}
setFieldValue={setFieldValue}
columns={['byAuthors']}
triggerSearch={values['authors']?.length}
/>

<TagsInputGroup
name="submitters"
Expand All @@ -244,6 +254,7 @@ const SubmissionForm = ({ onChange = null }) => {
incident={values}
setFieldValue={setFieldValue}
columns={['byDatePublished']}
triggerSearch={values['date_published']?.length}
/>

<TextInputGroup
Expand Down Expand Up @@ -354,6 +365,7 @@ const SubmissionForm = ({ onChange = null }) => {
incident={values}
setFieldValue={setFieldValue}
columns={['byIncidentId']}
triggerSearch={values['incident_ids']?.length}
/>

<div className="mt-3">
Expand Down

0 comments on commit 550dc71

Please sign in to comment.