Skip to content

Commit

Permalink
Merge pull request #177 from blend-capital/fix-missing-backstop-claim
Browse files Browse the repository at this point in the history
fix: patch backstop emissions est sim and use better cache invalidation
  • Loading branch information
mootz12 authored Dec 4, 2024
2 parents a7755b0 + 7c1f1c1 commit 7ef2964
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 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.3.0",
"version": "1.3.1",
"private": true,
"type": "module",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions src/contexts/wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ export const WalletProvider = ({ children = null as any }) => {
} else {
cleanBackstopPoolCache(claimArgs.pool_addresses[0].toString());
}
cleanBackstopCache();
cleanWalletCache();
}
}
Expand Down
13 changes: 12 additions & 1 deletion src/hooks/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,19 @@ export function useQueryClientCacheCleaner(): {

const cleanWalletCache = () => {
queryClient.invalidateQueries({
predicate: (query) => query.queryKey[0] === 'balance' || query.queryKey[0] === 'account',
predicate: (query) =>
query.queryKey[0] === 'balance' ||
query.queryKey[0] === 'account' ||
query.queryKey[0] === 'sim',
});

// Re-invalide the balance and account queries to ensure they are re-fetched after Horizon is updated
// This is a temporary solution until we have a better way to handle delayed Horizon updates
setTimeout(() => {
queryClient.invalidateQueries({
predicate: (query) => query.queryKey[0] === 'balance' || query.queryKey[0] === 'account',
});
}, 1000);
};

const cleanBackstopCache = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/backstop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const Backstop: NextPage = () => {
depositTokenAddress: backstop.config.blndTkn,
depositTokenAmount: FixedMath.toFixed(backstopUserEst.emissions, 7),
minLPTokenAmount: BigInt(0),
user: walletAddress,
user: backstop.id,
})
.toXDR('base64')
: undefined;
Expand Down

1 comment on commit 7ef2964

@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.