Skip to content

Commit 64da137

Browse files
committed
fix(web): react-tanstack-query-error-catch
1 parent cba2c6c commit 64da137

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,19 @@ const StakeWithdrawButton: React.FC<IActionButton> = ({ amount, parsedAmount, ac
215215
if (status) {
216216
await refetchAllowance();
217217
const refetchData = await refetchSetStake();
218+
// check for a relatively new error with react/tanstack-query:
219+
// https://github.com/TanStack/query/issues/8209
220+
if (!refetchData.data)
221+
setPopupStepsState(
222+
getStakeSteps(
223+
StakeSteps.ApproveFailed,
224+
amount,
225+
theme,
226+
hash,
227+
undefined,
228+
new Error("Something went wrong. Please restart the process.")
229+
)
230+
);
218231

219232
handleStake(refetchData.data, hash);
220233
} else setPopupStepsState(getStakeSteps(StakeSteps.ApproveFailed, amount, theme, hash));
@@ -277,6 +290,7 @@ const StakeWithdrawButton: React.FC<IActionButton> = ({ amount, parsedAmount, ac
277290
setIsPopupOpen(false);
278291
setIsSuccess(false);
279292
setAmount("");
293+
setPopupStepsState(undefined);
280294
};
281295

282296
return (

web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawPopup/Header.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { uncommify } from "utils/commify";
1212

1313
import { useJurorStakeDetailsQuery } from "queries/useJurorStakeDetailsQuery";
1414

15-
import QuantityToSimulate from "../SimulatorPopup/QuantityToSimulate";
15+
import QuantityToSimulate from "../Simulator/QuantityToSimulate";
1616
import { ActionType } from "../StakeWithdrawButton";
1717

1818
const StakingMsgContainer = styled.div`

0 commit comments

Comments
 (0)