From 5735a24c9e93cf1d19f9007528f91e7e645f6bb2 Mon Sep 17 00:00:00 2001 From: Jeroen Offerijns Date: Wed, 31 Jul 2024 00:25:57 +0200 Subject: [PATCH] Fix warning --- centrifuge-app/src/pages/Loan/ExternalRepayForm.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/centrifuge-app/src/pages/Loan/ExternalRepayForm.tsx b/centrifuge-app/src/pages/Loan/ExternalRepayForm.tsx index 2ef55d9aa..6e8e9822f 100644 --- a/centrifuge-app/src/pages/Loan/ExternalRepayForm.tsx +++ b/centrifuge-app/src/pages/Loan/ExternalRepayForm.tsx @@ -118,11 +118,7 @@ export function ExternalRepayForm({ loan, destination }: { loan: ExternalLoan; d const repayFormRef = React.useRef(null) useFocusInvalidInput(repayForm, repayFormRef) - if (loan.status === 'Closed' || ('valuationMethod' in loan.pricing && loan.pricing.valuationMethod !== 'oracle')) { - return null - } - - const debt = loan.outstandingDebt?.toDecimal() || Dec(0) + const debt = ('outstandingDebt' in loan && loan.outstandingDebt?.toDecimal()) || Dec(0) const { maxAvailable, maxInterest, totalRepay } = React.useMemo(() => { const outstandingInterest = (loan as ActiveLoan).outstandingInterest.toDecimal() ?? Dec(0) const { quantity, interest, amountAdditional, price } = repayForm.values @@ -146,6 +142,10 @@ export function ExternalRepayForm({ loan, destination }: { loan: ExternalLoan; d } }, [loan, destinationLoan, balance, repayForm.values]) + if (loan.status === 'Closed' || ('valuationMethod' in loan.pricing && loan.pricing.valuationMethod !== 'oracle')) { + return null + } + return ( <> {currentFace ? (