Skip to content

Commit

Permalink
Fix exhaustive-deps warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Emre Bogazliyanlioglu <[email protected]>
  • Loading branch information
emreboga committed Dec 10, 2024
1 parent 3d11e09 commit 9d86371
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const GasSlider = (props: {

useEffect(() => {
dispatch(setToNativeToken(debouncedPercentage / 100));
}, [debouncedPercentage]);
}, [debouncedPercentage, dispatch]);

const nativeGasPrice = useMemo(() => {
if (!destChain) {
Expand All @@ -117,7 +117,6 @@ const GasSlider = (props: {
const tokenAmount = amount.display(
amount.truncate(props.destinationGasDrop, 6),
);
console.log(tokenAmount);

const tokenPrice = calculateUSDPrice(
props.destinationGasDrop,
Expand Down
10 changes: 7 additions & 3 deletions wormhole-connect/src/views/v2/TxHistory/Widget/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ const WidgetItem = (props: Props) => {
}

return eta - timePassed;
// totalSeconds is not used in this hook but we still need it here
// to update the remaining eta every second.
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [eta, timestamp, totalSeconds]);

// Displays the countdown
Expand Down Expand Up @@ -189,7 +192,7 @@ const WidgetItem = (props: Props) => {
}

return ((eta - etaRemaining) / eta) * 100;
}, [eta, etaRemaining, isCompleted]);
}, [eta, etaExpired, etaRemaining]);

// Start the countdown timer
useEffect(() => {
Expand All @@ -200,7 +203,7 @@ const WidgetItem = (props: Props) => {
// 3- we have the remaining eta
restart(new Date(Date.now() + etaRemaining), true);
}
}, [etaRemaining, isCompleted, isRunning]);
}, [etaRemaining, isCompleted, isRunning, restart]);

// Action handler to navigate user to the Redeem view of this transaction
const resumeTransaction = useCallback(async () => {
Expand Down Expand Up @@ -238,6 +241,7 @@ const WidgetItem = (props: Props) => {
}
}, [dispatch, receipt, route, routeContext, timestamp, txDetails]);

// Do not render this widget if we don't have the transaction or the token config
if (!transaction || !tokenConfig) {
return <></>;
}
Expand Down Expand Up @@ -267,7 +271,7 @@ const WidgetItem = (props: Props) => {
<Stack direction="row" alignItems="center">
<Typography fontSize={14} marginRight="8px">
{`${sdkAmount.display(sdkAmount.truncate(amount, 4))} ${
config.tokens[tokenKey].symbol
tokenConfig.symbol
}`}
</Typography>
<Box className={classes.chainIcon}>
Expand Down

0 comments on commit 9d86371

Please sign in to comment.