This commit is contained in:
2026-06-18 15:27:03 +03:00
parent f17367658d
commit 594ba4fd07
4 changed files with 21 additions and 107 deletions

View File

@@ -60,10 +60,13 @@ export function useAddLp() {
const qc = useQueryClient()
return useMutation({
mutationFn: (input: LpDepositInput) => addLp(input),
// Депозит отражается в сети не мгновенно: баланс обновляем сразу, позиции — с задержкой,
// иначе ранний рефетч «мигнул» бы (позиции ещё нет). Паттерн из useStake.
// Депозит отражается в сети не мгновенно. Первый рефетч делаем не сразу, а спустя 1.5 с,
// и повторяем для позиций через 6 с — позиция может ещё не появиться на чейне. Паттерн из useStake.
onSettled: () => {
qc.invalidateQueries({ queryKey: ['wallet', 'balance', 'ETH'] })
setTimeout(() => {
qc.invalidateQueries({ queryKey: ['wallet', 'balance', 'ETH'] })
qc.invalidateQueries({ queryKey: ['pools', 'positions'] })
}, 1500)
setTimeout(() => {
qc.invalidateQueries({ queryKey: ['pools', 'positions'] })
qc.invalidateQueries({ queryKey: ['wallet', 'balance', 'ETH'] })