From 2c1bc0a66d65ddcefa647c43124b9c292acd7b98 Mon Sep 17 00:00:00 2001 From: AdamW Date: Fri, 1 Nov 2024 15:36:43 +0200 Subject: [PATCH] fix(utils): make 'unwrap' update immediate after resolve --- src/vanilla/utils/unwrap.ts | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/vanilla/utils/unwrap.ts b/src/vanilla/utils/unwrap.ts index 8166b0b452..2504f68d51 100644 --- a/src/vanilla/utils/unwrap.ts +++ b/src/vanilla/utils/unwrap.ts @@ -60,17 +60,16 @@ export function unwrap( return { v: promise as Awaited } } if (promise !== prev?.p) { - promise - .then( - (v) => { - promiseResultCache.set(promise, v as Awaited) - setSelf() - }, - (e) => { - promiseErrorCache.set(promise, e) - setSelf() - } - ) + promise.then( + (v) => { + promiseResultCache.set(promise, v as Awaited) + setSelf() + }, + (e) => { + promiseErrorCache.set(promise, e) + setSelf() + }, + ) } if (promiseErrorCache.has(promise)) { throw promiseErrorCache.get(promise)