Commit 39fa413
Fix broken new-interlinear-project (#122)
* Fix broken new-interlinear-project
* Address code review feedback on fix-create-proj
- Restructure createAndPersistProject to eliminate duplicate
setCreateSourceIsSelect/setModal calls via a single exit path
- Set isCreating during the discard-confirm createAndPersistProject
path so the create modal buttons are disabled in that flow too
- Update stale JSDoc: PendingReplace comment and component summary
now accurately describe the immediate-persist New behavior
- Split the old New-flow test into success and failure cases so
resetActiveProject is asserted for the right reason in each
- Add validation-failure test (parse succeeds, non-project shape)
to cover lines 242-245 and restore 100% coverage
- Fix no-type-assertion lint error in makeWebViewStateWithActiveProjectSpies
- Update discard-confirm test to assert createProject is called after confirm
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Send error notification on all createAndPersistProject failure paths
Matches the openProject convention: the catch block now sends the same
notification as the validation-failure path, so transport-level
rejections (where the backend may not have reached its own notification
send) also surface visible feedback to the user.
Expanded the JSDoc to document why the pre-round-trip newDraft() call
is safe: dirty=false means all draft data is committed to the active
project (or the draft was empty), and dirty=true means the user has
already confirmed discarding via DiscardDraftConfirm.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Fix duplicate notification and keep create modal open on failure
- Remove papi.notifications.send from createAndPersistProject catch
block; interlinearizer.createProject already sends its own
notification before rethrowing, so the second call caused a
duplicate toast (handleSaveAsNew follows the same convention)
- createAndPersistProject now returns boolean success; callers own
the modal transition so the create modal stays open on failure,
preserving the user name/description/language inputs for retry
- useDraftProject.ts newDraft JSDoc updated to reflect that the
caller is responsible for immediately persisting to the backend
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Cover discard-confirm -> create success path in tests
The handleConfirmReplace else branch was uncovered: the existing
test used the default mock (undefined -> JSON.parse throws ->
success false), leaving the if (success) close path unreached.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Fix false-negative in discard-confirm pre-submit assertion
expect.anything() does not match undefined, so not.toHaveBeenCalledWith
with five expect.anything() placeholders passed even when createProject
was called with undefined as arg 4. Replace with the exact expected
argument values so the assertion correctly guards the not-yet-called path.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Restore expect.anything() for non-undefined args in createProject guard
Only arg 4 (undefined targetProjectId) needed to be explicit;
the other arguments are non-undefined so expect.anything() is correct.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 31ee21d commit 39fa413
3 files changed
Lines changed: 240 additions & 41 deletions
File tree
- src
- __tests__/components/modals
- components/modals
- hooks
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
295 | 314 | | |
296 | 315 | | |
297 | 316 | | |
| |||
452 | 471 | | |
453 | 472 | | |
454 | 473 | | |
455 | | - | |
| 474 | + | |
| 475 | + | |
456 | 476 | | |
457 | 477 | | |
| 478 | + | |
458 | 479 | | |
459 | 480 | | |
460 | 481 | | |
461 | 482 | | |
462 | 483 | | |
463 | 484 | | |
464 | 485 | | |
465 | | - | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
466 | 490 | | |
467 | 491 | | |
468 | 492 | | |
469 | 493 | | |
470 | 494 | | |
471 | 495 | | |
472 | | - | |
473 | | - | |
| 496 | + | |
474 | 497 | | |
475 | 498 | | |
476 | 499 | | |
477 | 500 | | |
478 | 501 | | |
479 | | - | |
| 502 | + | |
480 | 503 | | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
486 | 509 | | |
487 | | - | |
| 510 | + | |
488 | 511 | | |
489 | 512 | | |
490 | 513 | | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
491 | 573 | | |
492 | 574 | | |
493 | 575 | | |
| |||
540 | 622 | | |
541 | 623 | | |
542 | 624 | | |
543 | | - | |
| 625 | + | |
544 | 626 | | |
545 | 627 | | |
546 | 628 | | |
547 | 629 | | |
548 | 630 | | |
549 | | - | |
| 631 | + | |
550 | 632 | | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
551 | 641 | | |
552 | 642 | | |
553 | 643 | | |
| |||
557 | 647 | | |
558 | 648 | | |
559 | 649 | | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
560 | 681 | | |
561 | 682 | | |
562 | 683 | | |
| |||
0 commit comments