fix: wrap unstakePosition polling loop in try/finally to prevent loading lock (#448)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e85ff85950
commit
372f49f6a5
1 changed files with 10 additions and 7 deletions
|
|
@ -216,6 +216,7 @@ async function unstakePosition() {
|
|||
const POLL_INTERVAL_MS = 1000;
|
||||
const TIMEOUT_MS = 30_000;
|
||||
const deadline = Date.now() + TIMEOUT_MS;
|
||||
try {
|
||||
while (Date.now() < deadline) {
|
||||
const { positions } = await loadActivePositions(currentChainId.value);
|
||||
if (!positions.some(p => BigInt(p.id) === props.id)) break;
|
||||
|
|
@ -223,8 +224,10 @@ async function unstakePosition() {
|
|||
await new Promise<void>(resolve => setTimeout(resolve, POLL_INTERVAL_MS));
|
||||
}
|
||||
await loadPositions(currentChainId.value);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadActivePositionData() {
|
||||
loading.value = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue