diff --git a/.changeset/tricky-carrots-peel.md b/.changeset/tricky-carrots-peel.md new file mode 100644 index 0000000000..fa2cad774f --- /dev/null +++ b/.changeset/tricky-carrots-peel.md @@ -0,0 +1,5 @@ +--- +"go-web-app": patch +--- + +Fix contact details in Field Report being always required when filled once diff --git a/app/src/views/CountryProfileOverview/index.tsx b/app/src/views/CountryProfileOverview/index.tsx index 7ec55def4e..e9cd7e62a5 100644 --- a/app/src/views/CountryProfileOverview/index.tsx +++ b/app/src/views/CountryProfileOverview/index.tsx @@ -168,6 +168,7 @@ export function Component() { return undefined; } + // FIXME: this sort will mutate the data const orderedMonth = month.sort( (a, b) => compareNumber(monthToOrderMap[a], monthToOrderMap[b]), ); diff --git a/app/src/views/Emergencies/index.tsx b/app/src/views/Emergencies/index.tsx index 35831e6f65..53214d03a9 100644 --- a/app/src/views/Emergencies/index.tsx +++ b/app/src/views/Emergencies/index.tsx @@ -139,6 +139,7 @@ export function Component() { const numAffectedCalculated = sumSafe( (events?.map( (event) => { + // FIXME: this sort will mutate the data const latestFieldReport = event.field_reports.sort( (a, b) => ( new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime() diff --git a/app/src/views/FieldReportForm/ActionsFields/index.tsx b/app/src/views/FieldReportForm/ActionsFields/index.tsx index 4682448b1e..56907e9469 100644 --- a/app/src/views/FieldReportForm/ActionsFields/index.tsx +++ b/app/src/views/FieldReportForm/ActionsFields/index.tsx @@ -114,6 +114,7 @@ function ActionsFields(props: Props) { const actionsError = getErrorObject(error?.actions_taken); + // FIXME: We might need to use useFormArrayWithEmptyCheck const { setValue: setActionValue, } = useFormArray<'actions_taken', ActionValue>( diff --git a/app/src/views/FieldReportForm/EarlyActionsFields/index.tsx b/app/src/views/FieldReportForm/EarlyActionsFields/index.tsx index b25b1baa1f..0b50c46dc6 100644 --- a/app/src/views/FieldReportForm/EarlyActionsFields/index.tsx +++ b/app/src/views/FieldReportForm/EarlyActionsFields/index.tsx @@ -104,6 +104,7 @@ function EarlyActionFields(props: Props) { const actionsError = getErrorObject(error?.actions_taken); + // FIXME: We might need to use useFormArrayWithEmptyCheck const { setValue: setActionValue, } = useFormArray<'actions_taken', ActionValue>( diff --git a/app/src/views/PerAssessmentForm/AreaInput/ComponentInput/index.tsx b/app/src/views/PerAssessmentForm/AreaInput/ComponentInput/index.tsx index 4146988b44..aeadff5e4d 100644 --- a/app/src/views/PerAssessmentForm/AreaInput/ComponentInput/index.tsx +++ b/app/src/views/PerAssessmentForm/AreaInput/ComponentInput/index.tsx @@ -122,6 +122,7 @@ function ComponentInput(props: Props) { [error], ); + // FIXME: We might need to use useFormArrayWithEmptyCheck const { setValue: setQuestionValue, } = useFormArray<'question_responses', NonNullable[number]>( @@ -150,6 +151,7 @@ function ComponentInput(props: Props) { const groupedQuestions = useMemo( () => listToGroupList( + // FIXME: this sort will mutate the data questions?.sort((q1, q2) => compareNumber(q1.question_num, q2.question_num)), (question) => question.question_group ?? NO_GROUP, ), diff --git a/app/src/views/PerAssessmentForm/AreaInput/index.tsx b/app/src/views/PerAssessmentForm/AreaInput/index.tsx index 95dd698806..9ae5da7669 100644 --- a/app/src/views/PerAssessmentForm/AreaInput/index.tsx +++ b/app/src/views/PerAssessmentForm/AreaInput/index.tsx @@ -81,6 +81,7 @@ function AreaInput(props: Props) { }), ); + // FIXME: We might need to use useFormArrayWithEmptyCheck const { setValue: setQuestionResponseValue, } = useFormArray('component_responses', setFieldValue); diff --git a/app/src/views/PerAssessmentForm/index.tsx b/app/src/views/PerAssessmentForm/index.tsx index 15aaceac34..5ae75f48f7 100644 --- a/app/src/views/PerAssessmentForm/index.tsx +++ b/app/src/views/PerAssessmentForm/index.tsx @@ -310,6 +310,7 @@ export function Component() { formContentRef.current?.scrollIntoView(); }, []); + // FIXME: We might need to use useFormArrayWithEmptyCheck const { setValue: setAreaResponsesValue, } = useFormArray('area_responses', setFieldValue); diff --git a/app/src/views/PerPrioritizationForm/index.tsx b/app/src/views/PerPrioritizationForm/index.tsx index 1b87ed6adc..f73a910086 100644 --- a/app/src/views/PerPrioritizationForm/index.tsx +++ b/app/src/views/PerPrioritizationForm/index.tsx @@ -151,6 +151,7 @@ export function Component() { }, }); + // FIXME: We might need to use useFormArrayWithEmptyCheck const { setValue: setComponentValue, removeValue: removeComponentValue, diff --git a/app/src/views/PerWorkPlanForm/index.tsx b/app/src/views/PerWorkPlanForm/index.tsx index ce7914f28a..0888fa6e19 100644 --- a/app/src/views/PerWorkPlanForm/index.tsx +++ b/app/src/views/PerWorkPlanForm/index.tsx @@ -141,6 +141,7 @@ export function Component() { [value?.prioritized_action_responses], ); + // FIXME: Not sure if this is required const customComponentResponseMapping = useMemo( () => ( listToMap( @@ -211,6 +212,7 @@ export function Component() { }, }); + // FIXME: We might need to use useFormArrayWithEmptyCheck const { setValue: setComponentValue, } = useFormArray<'prioritized_action_responses', NonNullable[number]>( @@ -218,6 +220,7 @@ export function Component() { setFieldValue, ); + // FIXME: We might need to use useFormArrayWithEmptyCheck const { setValue: setCustomComponentValue, removeValue: removeCustomComponentValue,