Skip to content

Commit 2666394

Browse files
feat: re-invalidate governance cache after gasless vote to catch indexer lag
1 parent 251b918 commit 2666394

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/components/transactions/GovVote/GovVoteActions.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,13 @@ export const GovVoteActions = ({
294294
success: true,
295295
});
296296

297+
// The relay indexes the VoteEmitted event asynchronously, so this immediate
298+
// refetch usually races ahead of the indexer. Refetch again after a short
299+
// delay to pick up the freshly-cast vote.
297300
queryClient.invalidateQueries({ queryKey: queryKeysFactory.governanceCache });
301+
setTimeout(() => {
302+
queryClient.invalidateQueries({ queryKey: queryKeysFactory.governanceCache });
303+
}, 8000);
298304
return;
299305
} catch (err) {
300306
// Relayer temporarily down — fall back to a self-paid vote. Any other relay

0 commit comments

Comments
 (0)