Skip to content

Commit

Permalink
chore: fix incomplete reference in annual report form summary
Browse files Browse the repository at this point in the history
  • Loading branch information
mikevespi committed May 16, 2024
1 parent 497f213 commit 39bd3b8
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions app/components/Form/ProjectAnnualReportFormSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const ProjectAnnualReportFormSummary: React.FC<Props> = ({

const annualReportsJSX = useMemo(() => {
return sortedAnnualReports.map((annualReport, index) => {
const latestCommittedData = latestCommittedReportMap[annualReport.newFormData.reportingRequirementIndex]
if (!annualReport) return;
// Set the formSchema and formData based on showing the diff or not
const { formSchema, formData } = !renderDiff
Expand All @@ -125,9 +126,7 @@ const ProjectAnnualReportFormSummary: React.FC<Props> = ({
: getFilteredSchema(
annualReport.formByJsonSchemaName.jsonSchema.schema as JSONSchema7,
annualReport,
latestCommittedReportMap[
annualReport.newFormData.reportingRequirementIndex
]
latestCommittedData
);

if (
Expand All @@ -137,13 +136,6 @@ const ProjectAnnualReportFormSummary: React.FC<Props> = ({
)
return null;

const latestCommittedData =
latestCommittedAnnualReportFormChanges?.edges?.find(
({ node }) =>
node.newFormData.reportingRequirementIndex ===
annualReport.newFormData.reportingRequirementIndex
)?.node?.newFormData;

return (
<div key={index} className="reportContainer">
<header>
Expand Down Expand Up @@ -177,7 +169,7 @@ const ProjectAnnualReportFormSummary: React.FC<Props> = ({
uiSchema={reportingRequirementUiSchema}
formContext={{
operation: annualReport.operation,
latestCommittedData,
latestCommittedData: latestCommittedData?.newFormData,
isAmendmentsAndOtherRevisionsSpecific:
isOnAmendmentsAndOtherRevisionsPage,
}}
Expand All @@ -196,6 +188,7 @@ const ProjectAnnualReportFormSummary: React.FC<Props> = ({
isOnAmendmentsAndOtherRevisionsPage,
renderDiff,
sortedAnnualReports,
latestCommittedReportMap
]);

// Update the hasDiff state in the CollapsibleFormWidget to define if the form has diffs to show
Expand Down

0 comments on commit 39bd3b8

Please sign in to comment.