Skip to content

Commit

Permalink
fix: correct budgets diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
BCerki committed Sep 11, 2023
1 parent 205ea51 commit d338d91
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions app/components/Form/ProjectFormSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ const ProjectFormSummary: React.FC<Props> = ({
Object.keys(formData).length === 0),
[projectFormChange, formData]
);
console.log("projectFormNotUpdated", projectFormNotUpdated);
// Update the hasDiff state in the CollapsibleFormWidget to define if the form has diffs to show
useEffect(
() => setHasDiff && setHasDiff(!projectFormNotUpdated),
Expand Down
1 change: 1 addition & 0 deletions app/components/Form/ProjectFundingAgreementForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ const ProjectFundingAgreementForm: React.FC<Props> = (props) => {
: "funding_parameter_IA";

const addFundingAgreement = () => {
console.log("in add funding agreement");
createFundingParameterFormChange({
variables: {
input: {
Expand Down
10 changes: 4 additions & 6 deletions app/components/Form/ProjectFundingAgreementFormSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ const ProjectFundingAgreementFormSummary: React.FC<Props> = ({
revision;

const fundingAgreementSummary =
summaryProjectFundingAgreementFormChanges.edges[0]?.node;
summaryProjectFundingAgreementFormChanges.edges.filter(
({ node }) => node.operation !== "ARCHIVE"
)[0]?.node;

const newData = {
...fundingAgreementSummary?.newFormData,
Expand Down Expand Up @@ -266,11 +268,7 @@ const ProjectFundingAgreementFormSummary: React.FC<Props> = ({
[fundingAgreementFormNotUpdated, setHasDiff]
);

// This condition handles the case where the form is archived
if (
!fundingAgreementFormNotUpdated &&
fundingAgreementSummary?.operation === "ARCHIVE"
) {
if (!fundingAgreementSummary) {
return (
<div>
{!isOnAmendmentsAndOtherRevisionsPage && (
Expand Down
1 change: 1 addition & 0 deletions app/components/ProjectRevision/CollapsibleFormWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const CollapsibleFormWidget: React.FC<CollapsibleFormWidgetProps> = ({
const [hasDiff, setHasDiff] = useState(false);
const [isOpen, setIsOpen] = useState(true); //This has to be true to start with, otherwise it will prevent the children from rendering
const cursorStyle = hasDiff ? "pointer" : "default";

const widgetQuery = useFragment(
collapsibleFormWidgetFragment,
projectRevision
Expand Down

0 comments on commit d338d91

Please sign in to comment.