Commit 324c62c
XS✔ ◾ fix: stop update-ready reminder from re-popping and stacking within a session (#972)
* fix: stop update-ready reminder from re-popping and stacking within a session (#456)
Clicking "Remind me later" on the update-ready dialog only guarded the
dialog's own "Later" state, not re-entrancy: if the periodic ~10-minute
update check fired another "update-downloaded" event while the first
dialog was still open, a second dialog would stack on top of it. Add an
isUpdateDialogOpen guard so only one reminder dialog can be shown at a
time, cleared once the user responds.
Closes #456
* address review: bound the update dialog + short-circuit post-restart events (#456)
- Add a 5-minute timeout fallback so a never-settling showMessageBox()
can't leave isUpdateDialogOpen stuck true forever, silently
suppressing all future update-ready reminders (minor finding).
- Add an isRestartingToInstall short-circuit so an update-downloaded
event landing in the gap between the isUpdateDialogOpen reset and
the deferred quitAndInstall() can't stack a second dialog moments
before quit (minor finding).
- Test: await the guard's reset/microtask flush via vi.waitFor instead
of firing-and-forgetting the resolved dialog promise (nit).
- Test: add coverage for the guard's release-and-reuse path via the
new timeout fallback, and for the Restart Now short-circuit (nit).
* address review: honor the real dialog response instead of the race (#456)
The 5-minute Promise.race timeout previously reset isUpdateDialogOpen
and had .then/.catch/.finally attached to the race, not to the real
dialog.showMessageBox() promise. Once the timeout "won", a later
update-downloaded event could stack a second native dialog on top of
the still-open first one, and the user's eventual real click on the
original dialog fired no callback at all (Promise.race only resolves
the winning branch's continuation).
Fix: attach the response handler directly to dialogPromise so a late
click is always honored, and use a separate watchdog that only logs a
warning and frees the guard for future events after 5 minutes - it
never touches dialogPromise's own chain. A per-invocation requestId
stops an abandoned dialog's very-late resolution from clobbering a
newer dialog's guard state.
Also documents (rather than "fixes") that isRestartingToInstall is
intentionally never reset - quitAndInstall() is a fire-and-forget
setImmediate() call with no failure signal, so permanently suppressing
reminders once the user has committed to restarting is the safer
failure mode. Removes the now-unused -1 timeout sentinel entirely
(the Promise.race/synthetic-result approach it belonged to is gone).
Adds a regression test pinning the blocking fix: dialog 1 times out,
guard releases, dialog 2 opens for a new event, then dialog 1's
original promise resolves late - asserting the late response is still
honored and does not clobber dialog 2's guard state.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* address review: guard .then() with requestId so a stale dialog can't clobber a newer one (#456)
muster round 3 found that .finally() checked updateDialogRequestId before
releasing the guard, but .then() had no such check — a late click on an
abandoned, superseded dialog could still flip updateDialogDismissedInSession
or trigger quitAndInstall() out from under a different, currently-open
dialog. Added the same requestId check to .then(), clear the watchdog
timer once a dialog settles on its own, and rewrote the round-2 regression
test (which was inadvertently confounded by updateDialogDismissedInSession
and didn't actually exercise the buggy path) to correctly pin the new,
request-scoped behavior.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* fix: keep update dialog guard until dialog closes
---------
Co-authored-by: armada-lookout <armada-lookout@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Willow Lyu <iqay_lyu@hotmail.com>1 parent 4b2d557 commit 324c62c
2 files changed
Lines changed: 181 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
13 | | - | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
19 | 35 | | |
20 | 36 | | |
21 | 37 | | |
| |||
24 | 40 | | |
25 | 41 | | |
26 | 42 | | |
27 | | - | |
| 43 | + | |
28 | 44 | | |
29 | 45 | | |
| 46 | + | |
30 | 47 | | |
31 | 48 | | |
32 | 49 | | |
| |||
373 | 390 | | |
374 | 391 | | |
375 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
78 | 95 | | |
79 | 96 | | |
80 | 97 | | |
| |||
111 | 128 | | |
112 | 129 | | |
113 | 130 | | |
114 | | - | |
| 131 | + | |
| 132 | + | |
115 | 133 | | |
116 | 134 | | |
117 | 135 | | |
118 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
119 | 152 | | |
120 | 153 | | |
121 | 154 | | |
| |||
127 | 160 | | |
128 | 161 | | |
129 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
130 | 166 | | |
131 | 167 | | |
132 | 168 | | |
| |||
135 | 171 | | |
136 | 172 | | |
137 | 173 | | |
138 | | - | |
| 174 | + | |
| 175 | + | |
139 | 176 | | |
140 | 177 | | |
141 | 178 | | |
142 | 179 | | |
143 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
144 | 187 | | |
145 | 188 | | |
146 | 189 | | |
| |||
0 commit comments