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:
openhands 2026-03-06 04:18:52 +00:00
parent e85ff85950
commit 372f49f6a5

View file

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