Skip to content

Commit

Permalink
fix loading on transaction error
Browse files Browse the repository at this point in the history
  • Loading branch information
yvesfracari committed Jun 18, 2024
1 parent 877162a commit cbd5d53
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion apps/cow-amm-deployer/src/contexts/ammDataContext.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"use client";

import { toast } from "@bleu/ui";
import React, { useEffect } from "react";
import useSWR from "swr";
import { Address } from "viem";
Expand Down Expand Up @@ -58,13 +59,21 @@ export const AmmDataContextProvider = ({
if (isPonderAPIUpToDate) {
mutateAmm();
setIsTransactionAwaiting(false);
toast({
title: "Transaction confirmed",
description: "The transaction has been confirmed",
variant: "success",
});
}
}, [isPonderAPIUpToDate]);

useEffect(() => {
if (!["final", "confirmed", "error", "idle"].includes(status || "")) {
if (!["final", "confirmed", "idle"].includes(status || "")) {
setIsTransactionAwaiting(true);
}
if (status === "error") {
setIsTransactionAwaiting(false);
}
}, [status]);

useEffect(() => {
Expand Down

0 comments on commit cbd5d53

Please sign in to comment.