Commit dd06d68
committed
Transfer: Fix stuck "Scanning" dialog race
The progress dialog could get stuck in "Scanning 0 files, 0 dirs" forever
when the user confirmed (or Playwright clicked) before `startScanPreview`
IPC returned. In that case, `previewId` was null when `TransferProgressDialog`
mounted. The dialog's null-recovery strategy was to adopt the ID from the
first scan event — but if those events fired between listener setup and
listener registration, they were lost, `previewId` stayed null, the status
check was skipped, and the dialog waited forever for events that never came.
- `TransferDialog.handleConfirm` now awaits the `startScan()` promise before
calling `onConfirm`, guaranteeing `previewId` is set (or scan errored)
- Double-confirm guard added since `handleConfirm` is now async
- `TransferProgressDialog` no longer tries to adopt `previewId` from events.
`isOurScanEvent` simplified, `effectivePreviewId` removed. The null case
now logs an error and falls through to `startOperation`
Consistent with the dialog's own `filterEvent` pattern for write operations:
subscribe first, then dispatch the command, then match events by known ID.1 parent 98d4cfc commit dd06d68
2 files changed
Lines changed: 47 additions & 38 deletions
File tree
- apps/desktop/src/lib/file-operations/transfer
Lines changed: 18 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
117 | 122 | | |
118 | 123 | | |
119 | 124 | | |
| |||
332 | 337 | | |
333 | 338 | | |
334 | 339 | | |
335 | | - | |
336 | | - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
337 | 343 | | |
338 | 344 | | |
339 | 345 | | |
340 | 346 | | |
341 | | - | |
| 347 | + | |
342 | 348 | | |
343 | 349 | | |
344 | 350 | | |
| |||
352 | 358 | | |
353 | 359 | | |
354 | 360 | | |
355 | | - | |
356 | | - | |
| 361 | + | |
| 362 | + | |
357 | 363 | | |
358 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
359 | 369 | | |
360 | 370 | | |
361 | 371 | | |
| |||
370 | 380 | | |
371 | 381 | | |
372 | 382 | | |
373 | | - | |
| 383 | + | |
374 | 384 | | |
375 | 385 | | |
376 | 386 | | |
377 | 387 | | |
378 | 388 | | |
379 | 389 | | |
380 | 390 | | |
381 | | - | |
| 391 | + | |
382 | 392 | | |
383 | 393 | | |
384 | 394 | | |
| |||
Lines changed: 29 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
148 | | - | |
149 | 147 | | |
150 | 148 | | |
151 | 149 | | |
| |||
406 | 404 | | |
407 | 405 | | |
408 | 406 | | |
409 | | - | |
| 407 | + | |
410 | 408 | | |
411 | 409 | | |
412 | 410 | | |
413 | 411 | | |
414 | | - | |
| 412 | + | |
415 | 413 | | |
416 | 414 | | |
417 | 415 | | |
| |||
427 | 425 | | |
428 | 426 | | |
429 | 427 | | |
430 | | - | |
| 428 | + | |
431 | 429 | | |
432 | 430 | | |
433 | 431 | | |
| |||
438 | 436 | | |
439 | 437 | | |
440 | 438 | | |
441 | | - | |
| 439 | + | |
442 | 440 | | |
443 | 441 | | |
444 | 442 | | |
| |||
451 | 449 | | |
452 | 450 | | |
453 | 451 | | |
454 | | - | |
| 452 | + | |
455 | 453 | | |
456 | 454 | | |
457 | 455 | | |
| |||
517 | 515 | | |
518 | 516 | | |
519 | 517 | | |
520 | | - | |
521 | | - | |
522 | | - | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
523 | 521 | | |
524 | 522 | | |
525 | 523 | | |
| |||
622 | 620 | | |
623 | 621 | | |
624 | 622 | | |
625 | | - | |
| 623 | + | |
626 | 624 | | |
627 | | - | |
628 | | - | |
| 625 | + | |
629 | 626 | | |
630 | 627 | | |
631 | 628 | | |
632 | 629 | | |
633 | 630 | | |
634 | 631 | | |
635 | 632 | | |
636 | | - | |
637 | | - | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
638 | 636 | | |
639 | 637 | | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
640 | 643 | | |
641 | 644 | | |
642 | 645 | | |
| |||
690 | 693 | | |
691 | 694 | | |
692 | 695 | | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | | - | |
702 | | - | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
703 | 704 | | |
704 | 705 | | |
705 | | - | |
706 | | - | |
707 | | - | |
| 706 | + | |
708 | 707 | | |
709 | 708 | | |
710 | 709 | | |
| |||
719 | 718 | | |
720 | 719 | | |
721 | 720 | | |
722 | | - | |
723 | | - | |
| 721 | + | |
| 722 | + | |
724 | 723 | | |
725 | 724 | | |
726 | 725 | | |
| |||
0 commit comments