Remove deep link path and prevent re-render from useEffect #7

Merged
nabarun merged 4 commits from deep-stack/laconic-wallet-web:sk-fix-memory-leak into main 2024-08-01 06:18:03 +00:00
2 changed files with 13 additions and 13 deletions
Showing only changes of commit 98755b9089 - Show all commits

View File

@ -50,9 +50,9 @@ const ApproveTransaction = ({ route }: ApproveTransactionProps) => {
const [account, setAccount] = useState<Account>(); const [account, setAccount] = useState<Account>();
const [cosmosStargateClient, setCosmosStargateClient] = const [cosmosStargateClient, setCosmosStargateClient] =
useState<LaconicClient>(); useState<LaconicClient>();
const [cosmosGasLimit, setCosmosGasLimit] = useState<string>(); const [cosmosGasLimit, setCosmosGasLimit] = useState<string>('');
const [fees, setFees] = useState<string>(); const [fees, setFees] = useState<string>('');
const [txError, setTxError] = useState<string>(); const [txError, setTxError] = useState<string>('');
const [isTxErrorDialogOpen, setIsTxErrorDialogOpen] = useState(false); const [isTxErrorDialogOpen, setIsTxErrorDialogOpen] = useState(false);
const [isRequestAccepted, setIsRequestAccepted] = useState(false); const [isRequestAccepted, setIsRequestAccepted] = useState(false);
@ -197,11 +197,11 @@ const ApproveTransaction = ({ route }: ApproveTransactionProps) => {
// This amount is total fees required for transaction // This amount is total fees required for transaction
amount: [ amount: [
{ {
amount: fees!, amount: fees,
denom: requestedNetwork!.nativeDenom!, denom: requestedNetwork!.nativeDenom!,
}, },
], ],
gas: cosmosGasLimit!, gas: cosmosGasLimit,
}, },
txMsg: transactionMessage, txMsg: transactionMessage,
}; };
@ -299,7 +299,7 @@ const ApproveTransaction = ({ route }: ApproveTransactionProps) => {
</> </>
</ScrollView> </ScrollView>
<TxErrorDialog <TxErrorDialog
error={txError!} error={txError}
visible={isTxErrorDialogOpen} visible={isTxErrorDialogOpen}
hideDialog={async () => { hideDialog={async () => {
setIsTxErrorDialogOpen(false); setIsTxErrorDialogOpen(false);

View File

@ -70,9 +70,9 @@ const ApproveTransfer = ({ route }: SignRequestProps) => {
const [isTxLoading, setIsTxLoading] = useState(false); const [isTxLoading, setIsTxLoading] = useState(false);
const [cosmosStargateClient, setCosmosStargateClient] = const [cosmosStargateClient, setCosmosStargateClient] =
useState<SigningStargateClient>(); useState<SigningStargateClient>();
const [fees, setFees] = useState<string>(); const [fees, setFees] = useState<string>('');
const [cosmosGasLimit, setCosmosGasLimit] = useState<string>(); const [cosmosGasLimit, setCosmosGasLimit] = useState<string>('');
const [txError, setTxError] = useState<string>(); const [txError, setTxError] = useState<string>('');
const [isTxErrorDialogOpen, setIsTxErrorDialogOpen] = useState(false); const [isTxErrorDialogOpen, setIsTxErrorDialogOpen] = useState(false);
const [ethGasPrice, setEthGasPrice] = useState<BigNumber | null>(); const [ethGasPrice, setEthGasPrice] = useState<BigNumber | null>();
const [ethGasLimit, setEthGasLimit] = useState<BigNumber>(); const [ethGasLimit, setEthGasLimit] = useState<BigNumber>();
@ -212,7 +212,7 @@ const ApproveTransfer = ({ route }: SignRequestProps) => {
// If requested chain is EVM compatible, set loading to false when ethMaxFee and ethPriorityFee have been populated // If requested chain is EVM compatible, set loading to false when ethMaxFee and ethPriorityFee have been populated
(ethMaxFee !== undefined && ethMaxPriorityFee !== undefined) || (ethMaxFee !== undefined && ethMaxPriorityFee !== undefined) ||
// Or if requested chain is a cosmos chain, set loading to false when cosmosGasLimit has been populated // Or if requested chain is a cosmos chain, set loading to false when cosmosGasLimit has been populated
cosmosGasLimit !== undefined !cosmosGasLimit
) { ) {
setIsLoading(false); setIsLoading(false);
} }
@ -311,11 +311,11 @@ const ApproveTransfer = ({ route }: SignRequestProps) => {
// This amount is total fees required for transaction // This amount is total fees required for transaction
amount: [ amount: [
{ {
amount: fees!, amount: fees,
denom: requestedNetwork!.nativeDenom!, denom: requestedNetwork!.nativeDenom!,
}, },
], ],
gas: cosmosGasLimit!, gas: cosmosGasLimit,
}, },
sendMsg, sendMsg,
memo: MEMO, memo: MEMO,
@ -655,7 +655,7 @@ const ApproveTransfer = ({ route }: SignRequestProps) => {
</> </>
)} )}
<TxErrorDialog <TxErrorDialog
error={txError!} error={txError}
visible={isTxErrorDialogOpen} visible={isTxErrorDialogOpen}
hideDialog={() => { hideDialog={() => {
setIsTxErrorDialogOpen(false); setIsTxErrorDialogOpen(false);