Repository navigation
Commit d018b9e
committed
fix(webview): harden viewStates reads and retry an unrestored view state
Two review findings on Zoo-Code-Org#2226.
1. getPersistedViewStates copied every entry blindly. A corrupt or half-written
viewStates record holding a null entry made prunePersistedViewStates throw while it
sorted by updatedAt, which rejected the queued save and lost the selection being
stored. Entries that are not objects are now dropped at the single read choke point
(both the cached and the fresh copy), so every writer - save, re-bind, re-key and the
claim check - sees only valid entries.
2. loadViewState swallowed a getCustomModes failure and returned normally, so a failed
restoration was indistinguishable from a completed one: setViewStateId kept the
adopted id, and every later registration of that id was swallowed by the
unchanged-id guard, so the selections were never reloaded. A load that aborts now
records the id as pending; a same-id registration passes the guard only while the id
is pending and still runs the persisted-entry claim check. The pending marker is
cleared only by a load that ran to completion. The id stays adopted after a
successful re-key (the entry is already under the stable name), and the rollback
still covers failures before that point.
Tests: 3 new cases in ClineProvider.spec.ts - corrupt entry cannot reject a save, a
failed load is retried by a same-id registration, a completed restoration stays behind
the guard.1 parent e262aeb commit d018b9e
2 files changed
Lines changed: 148 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
456 | 465 | | |
457 | 466 | | |
458 | 467 | | |
| |||
667 | 676 | | |
668 | 677 | | |
669 | 678 | | |
670 | | - | |
671 | | - | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
672 | 693 | | |
673 | 694 | | |
674 | 695 | | |
| |||
864 | 885 | | |
865 | 886 | | |
866 | 887 | | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
867 | 894 | | |
868 | 895 | | |
869 | | - | |
| 896 | + | |
870 | 897 | | |
871 | 898 | | |
872 | 899 | | |
| |||
5977 | 6004 | | |
5978 | 6005 | | |
5979 | 6006 | | |
| 6007 | + | |
5980 | 6008 | | |
5981 | 6009 | | |
| 6010 | + | |
| 6011 | + | |
| 6012 | + | |
| 6013 | + | |
| 6014 | + | |
| 6015 | + | |
| 6016 | + | |
5982 | 6017 | | |
5983 | 6018 | | |
5984 | 6019 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
5623 | 5624 | | |
5624 | 5625 | | |
5625 | 5626 | | |
| 5627 | + | |
| 5628 | + | |
| 5629 | + | |
| 5630 | + | |
| 5631 | + | |
| 5632 | + | |
| 5633 | + | |
| 5634 | + | |
| 5635 | + | |
| 5636 | + | |
| 5637 | + | |
| 5638 | + | |
| 5639 | + | |
| 5640 | + | |
| 5641 | + | |
| 5642 | + | |
| 5643 | + | |
| 5644 | + | |
| 5645 | + | |
| 5646 | + | |
| 5647 | + | |
| 5648 | + | |
| 5649 | + | |
| 5650 | + | |
| 5651 | + | |
| 5652 | + | |
| 5653 | + | |
| 5654 | + | |
| 5655 | + | |
| 5656 | + | |
| 5657 | + | |
| 5658 | + | |
| 5659 | + | |
| 5660 | + | |
| 5661 | + | |
| 5662 | + | |
| 5663 | + | |
| 5664 | + | |
| 5665 | + | |
| 5666 | + | |
| 5667 | + | |
| 5668 | + | |
| 5669 | + | |
| 5670 | + | |
| 5671 | + | |
| 5672 | + | |
| 5673 | + | |
| 5674 | + | |
| 5675 | + | |
| 5676 | + | |
| 5677 | + | |
| 5678 | + | |
| 5679 | + | |
| 5680 | + | |
| 5681 | + | |
| 5682 | + | |
| 5683 | + | |
| 5684 | + | |
| 5685 | + | |
| 5686 | + | |
| 5687 | + | |
| 5688 | + | |
| 5689 | + | |
| 5690 | + | |
| 5691 | + | |
| 5692 | + | |
| 5693 | + | |
| 5694 | + | |
| 5695 | + | |
| 5696 | + | |
| 5697 | + | |
| 5698 | + | |
| 5699 | + | |
| 5700 | + | |
| 5701 | + | |
| 5702 | + | |
| 5703 | + | |
| 5704 | + | |
| 5705 | + | |
| 5706 | + | |
| 5707 | + | |
| 5708 | + | |
| 5709 | + | |
| 5710 | + | |
| 5711 | + | |
| 5712 | + | |
| 5713 | + | |
| 5714 | + | |
| 5715 | + | |
| 5716 | + | |
| 5717 | + | |
| 5718 | + | |
| 5719 | + | |
| 5720 | + | |
| 5721 | + | |
| 5722 | + | |
| 5723 | + | |
| 5724 | + | |
| 5725 | + | |
| 5726 | + | |
| 5727 | + | |
| 5728 | + | |
| 5729 | + | |
| 5730 | + | |
| 5731 | + | |
| 5732 | + | |
| 5733 | + | |
| 5734 | + | |
| 5735 | + | |
5626 | 5736 | | |
5627 | 5737 | | |
5628 | 5738 | | |
| |||
0 commit comments