Fix NIP-07 timeout helper to preserve user gestures

This commit is contained in:
thePR0M3TH3AN committed 2025-09-30 16:22:50 -04:00
1 parent fd62159e61
commit 8d7d7a86cf
1 file changed
+13 -4
+13 -4
View File
@@ -62,10 +62,19 @@ function withNip07Timeout(operation) {
}, NIP07_LOGIN_TIMEOUT_MS);
});
return Promise.race([
Promise.resolve().then(operation),
timeoutPromise,
]).finally(() => {
let operationResult;
try {
operationResult = operation();
} catch (err) {
if (timeoutId) {
clearTimeout(timeoutId);
}
throw err;
}
const operationPromise = Promise.resolve(operationResult);
return Promise.race([operationPromise, timeoutPromise]).finally(() => {
if (timeoutId) {
clearTimeout(timeoutId);
}