@konemono/nostr-login 1.7.18 → 1.7.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konemono/nostr-login",
3
- "version": "1.7.18",
3
+ "version": "1.7.20",
4
4
  "description": "",
5
5
  "main": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",
@@ -72,7 +72,10 @@ class BannerManager extends EventEmitter {
72
72
  this.iframeReady = undefined;
73
73
  }
74
74
  this.banner.isLoading = false;
75
- this.banner.notify = { mode: '' };
75
+ // Don't clear timeout notification, user needs to see it
76
+ if (this.banner.notify?.mode !== 'timeout') {
77
+ this.banner.notify = { mode: '' };
78
+ }
76
79
  }
77
80
  }
78
81
 
@@ -56,19 +56,38 @@ class ProcessManager extends EventEmitter {
56
56
 
57
57
  let error;
58
58
  let result;
59
+ let raceFinished = false;
59
60
 
60
61
  try {
61
- result = await Promise.race([cb(), timeoutPromise]);
62
+ result = await Promise.race([
63
+ cb().then(r => {
64
+ if (!raceFinished) {
65
+ raceFinished = true;
66
+ return r;
67
+ }
68
+ // Race already finished (timed out), ignore this result
69
+ console.log('ProcessManager: ignoring late result after timeout');
70
+ throw new Error('Already timed out');
71
+ }),
72
+ timeoutPromise.then(
73
+ () => {
74
+ raceFinished = true;
75
+ throw new Error('Should not resolve');
76
+ },
77
+ (err) => {
78
+ raceFinished = true;
79
+ throw err;
80
+ }
81
+ )
82
+ ]);
62
83
  } catch (e) {
63
84
  error = e;
64
85
  }
65
86
 
66
87
  this.callCount--;
67
88
 
68
- // Only emit onCallEnd if not timed out (timeout already handled cleanup)
69
- if (!isTimedOut) {
70
- this.emit('onCallEnd');
71
- }
89
+ // Always emit onCallEnd for cleanup
90
+ this.emit('onCallEnd');
72
91
 
73
92
  // Clear the timer if it's the one we created
74
93
  if (this.callTimer === localTimer) {