Skip to content

Commit

Permalink
Merge pull request #158 from blend-capital/fix-exit-pool
Browse files Browse the repository at this point in the history
fix: correctly update memoized function with balance changes
  • Loading branch information
mootz12 authored Sep 21, 2024
2 parents 1cabddf + 4de0fd7 commit 6eaafa2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "blend-ui",
"version": "1.1.1",
"version": "1.1.2",
"private": true,
"type": "module",
"scripts": {
Expand Down
5 changes: 2 additions & 3 deletions src/components/backstop/BackstopExitAnvil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export const BackstopExitAnvil = () => {
const { data: lpBalanceRes } = useTokenBalance(
backstop?.backstopToken.id,
undefined,
undefined,
backstop !== undefined
horizonAccount
);

const [input, setInput] = useState<{ amount: string; slippage: string }>({
Expand Down Expand Up @@ -145,7 +144,7 @@ export const BackstopExitAnvil = () => {
} else {
return getErrorFromSim(input.amount, decimals, loading, simResponse, undefined);
}
}, [input, loadingEstimate, simResponse]);
}, [input, loadingEstimate, simResponse, lpBalance]);

if (backstop === undefined) {
return <Skeleton />;
Expand Down
11 changes: 10 additions & 1 deletion src/components/backstop/BackstopJoinAnvil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,16 @@ export const BackstopJoinAnvil = () => {
} else {
return getErrorFromSim(input.amount, decimals, loading, simResponse);
}
}, [input, currentToken.symbol, loadingEstimate, simResponse]);
}, [
input,
currentToken.symbol,
blndBalance,
usdcBalance,
loadingEstimate,
simResponse,
maxUSDCDeposit,
maxBLNDDeposit,
]);

if (backstop === undefined) {
return <Skeleton />;
Expand Down

1 comment on commit 6eaafa2

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

Please sign in to comment.