Skip to content

Commit 6572e89

Browse files
committed
fix(RemoveLiquidity): fixed deps in callback, approval button is now displayed in correct circumstances
1 parent 2112720 commit 6572e89

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

src/components/Market/OrderCard/components/AddLiquidity/AddLiquidity.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,20 @@ const AddLiquidity: React.FC = () => {
529529
) : (
530530
<>
531531
{isApproved() ? (
532-
<> </>
532+
<>
533+
{' '}
534+
<Button
535+
disabled={
536+
!isApproved() ||
537+
!parsedUnderlyingAmount?.gt(0) ||
538+
(hasLiquidity ? null : !parsedOptionAmount?.gt(0))
539+
}
540+
full
541+
size="sm"
542+
onClick={handleSubmitClick}
543+
text={`Add Liquidity`}
544+
/>
545+
</>
533546
) : (
534547
<>
535548
<Button
@@ -541,18 +554,6 @@ const AddLiquidity: React.FC = () => {
541554
/>
542555
</>
543556
)}
544-
545-
<Button
546-
disabled={
547-
!isApproved() ||
548-
!parsedUnderlyingAmount?.gt(0) ||
549-
(hasLiquidity ? null : !parsedOptionAmount?.gt(0))
550-
}
551-
full
552-
size="sm"
553-
onClick={handleSubmitClick}
554-
text={`Add Liquidity`}
555-
/>
556557
</>
557558
)}
558559
</Box>

src/components/Market/OrderCard/components/RemoveLiquidity/RemoveLiquidity.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ const RemoveLiquidity: React.FC = () => {
149149

150150
const isOptionApproved = useCallback(() => {
151151
return approved[0] || calculateLongBurn().isZero()
152-
}, [approved, item.entity])
152+
}, [approved, item.entity, ratio])
153153

154154
const isLPApproved = useCallback(() => {
155155
return approved[1] || signData
156-
}, [approved, item.entity, signData])
156+
}, [approved, item.entity, signData, ratio])
157157

158158
const uninitializedMarket = useCallback(() => {
159159
return (
@@ -225,8 +225,8 @@ const RemoveLiquidity: React.FC = () => {
225225
}, [uninitializedMarket, calculateLongBurn])
226226

227227
const calculateReceived = useCallback(() => {
228-
let underlyingReceived: string = '0'
229-
let shortReceived: string = '0'
228+
let underlyingReceived = '0'
229+
let shortReceived = '0'
230230
if (uninitializedMarket()) {
231231
return { shortReceived, underlyingReceived }
232232
}

0 commit comments

Comments
 (0)