Skip to content

Commit

Permalink
fix: try to recover deployment message id only once (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
SGiaccobasso authored Sep 10, 2024
1 parent 874a546 commit 590054a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/mean-kangaroos-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@axelarjs/maestro": patch
---

only try to recover deployment message id once
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,18 @@ const ConnectedInterchainTokensPage: FC<ConnectedInterchainTokensPageProps> = (

const utils = trpc.useUtils();

const { mutateAsync, isPending } =
const { mutateAsync, isPending, isSuccess } =
trpc.interchainToken.recoverDeploymentMessageIdByTokenId.useMutation();

// If the token does not have a deployment message id, try to
// recover it and store it in the db then update the token details
const recoverMessageId = useCallback(() => {
if (!props.deploymentMessageId && props.tokenId && !isPending) {
if (
!props.deploymentMessageId &&
props.tokenId &&
!isPending &&
!isSuccess
) {
void mutateAsync({ tokenId: props.tokenId }).then((result) => {
if (result === "updated") {
void utils.erc20.invalidate().then(() => void refetchTokenDetails());
Expand All @@ -211,6 +216,7 @@ const ConnectedInterchainTokensPage: FC<ConnectedInterchainTokensPageProps> = (
});
}
}, [
isSuccess,
isPending,
mutateAsync,
props.deploymentMessageId,
Expand Down

0 comments on commit 590054a

Please sign in to comment.