Skip to content

Commit

Permalink
Fixed consultations not loading properly on update (#4195)
Browse files Browse the repository at this point in the history
  • Loading branch information
FuriousLlama authored Jul 15, 2024
1 parent 2163610 commit 8087cdc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const AdministrationSubForm: React.FunctionComponent<
<InlineInput field="motiName" />
</SectionField>

<SectionField label="MOTI region" labelWidth="2" contentWidth="4" required>
<SectionField label="MOTI region" labelWidth="2" contentWidth="auto" required>
<UserRegionSelectContainer field="regionId" placeholder="Select region" required />
</SectionField>
<Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import useLookupCodeHelpers from '@/hooks/useLookupCodeHelpers';
import { ApiGen_Concepts_ConsultationLease } from '@/models/api/generated/ApiGen_Concepts_ConsultationLease';
import { ApiGen_Concepts_Lease } from '@/models/api/generated/ApiGen_Concepts_Lease';
import { getEmptyBaseAudit } from '@/models/defaultInitializers';
import { ILookupCode } from '@/store/slices/lookupCodes';

import { LeaseFormModel } from '../models';

Expand Down Expand Up @@ -56,7 +57,10 @@ const ConsultationSubForm: React.FunctionComponent<
);
};

export const getConsultations = (lease: ApiGen_Concepts_Lease, consultationTypes) => {
export const getConsultations = (
lease: ApiGen_Concepts_Lease,
consultationTypes: ILookupCode[],
) => {
if (lease.consultations?.length !== consultationTypes.length) {
const newConsultations: ApiGen_Concepts_ConsultationLease[] = [];

Expand Down Expand Up @@ -93,7 +97,7 @@ export const getConsultations = (lease: ApiGen_Concepts_Lease, consultationTypes
});
return newConsultations;
}
return [];
return lease.consultations;
};

export default ConsultationSubForm;
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,7 @@ exports[`AddLeaseContainer component > renders as expected 1`] = `
</label>
</div>
<div
class="c14 required text-left col-4"
class="c14 required text-left col-auto"
>
<div
class="required d-flex form-group"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ exports[`AdministrationSubForm component > renders as expected 1`] = `
</label>
</div>
<div
class="c3 required text-left col-4"
class="c3 required text-left col-auto"
>
<div
class="required d-flex form-group"
Expand Down

0 comments on commit 8087cdc

Please sign in to comment.