Skip to content

Commit

Permalink
fix: add useEffect to set isSubmitting false when step reaches pending
Browse files Browse the repository at this point in the history
  • Loading branch information
Polybius93 committed Dec 12, 2024
1 parent 2a2c239 commit 8d43b0a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContext, useState } from 'react';
import { useContext, useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';

import { VStack, useToast } from '@chakra-ui/react';
Expand Down Expand Up @@ -46,6 +46,13 @@ export function DepositTransactionScreen({

const [isSubmitting, setIsSubmitting] = useState(false);

useEffect(() => {
if (mintStep.step === MintSteps.PENDING) {
setIsSubmitting(false);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [mintStep.step]);

async function handleDeposit(depositAmount: number) {
if (!currentVault) return;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContext, useState } from 'react';
import { useContext, useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';

import { VStack, useToast } from '@chakra-ui/react';
Expand Down Expand Up @@ -36,6 +36,13 @@ export function WithdrawScreen({

const [isSubmitting, setIsSubmitting] = useState(false);

useEffect(() => {
if (unmintStep.step === RedeemSteps.PENDING) {
setIsSubmitting(false);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [unmintStep.step]);

async function handleWithdraw(withdrawAmount: number): Promise<void> {
if (currentVault) {
try {
Expand Down

0 comments on commit 8d43b0a

Please sign in to comment.