Repository navigation
Commit aa6037c
committed
fix(webview): seed the re-pinned view with the shared profile's settings
The row on src/core/webview/webviewMessageHandler.ts:691 was right about the mechanism. The launch
repair re-pinned this view to the still-valid shared profile and cleared the apiConfiguration
buffer, which left the view with a name in its overlay and no settings of its own: getState merges
viewLocalState over the shared values (ClineProvider.ts:4913) and a mutation carrying undefined
deletes the key (_updateViewLocalStateFromMutation, ClineProvider.ts:5298-5304), so the pinned view
resolved apiConfiguration from whatever the shared store names next - one sibling activation is
enough - while still displaying its own pin. The repair now seeds the pinned profile's stored
record without its name, which is how loadViewState pairs a name with its settings
(ClineProvider.ts:1137-1140).
One part of the finding is not what the code does. Nothing writes apiConfiguration into the durable
view entry: _persistViewLocalStateFromMutation (ClineProvider.ts:5322-5332) persists mode and
currentApiConfigName only, so the seed is an in-memory overlay write and the pin write below stays
the only durable part of the repair.
The seed is read before the pin write so both orderings stay safe. A failed seed write leaves the
pin unwritten, so the invalid selection stays retryable on the next launch; a seed that lands while
the pin write fails leaves the view holding the settings of the profile it is about to be pinned to
rather than the missing profile's stale buffer. The read is wrapped because the record can vanish
between the hasConfig check above and this getProfile call: falling back to an empty overlay is
what a re-pin did before, so the repair survives that race instead of being swallowed by the catch
around the block.
Tests: webviewMessageHandler.spec.ts:971-1013 pins the seed and rejects the empty overlay, 1032-1059 keeps
the seed-before-pin ordering, and 1061-1078 covers the vanished-record fallback. Control: head handler
with the new spec reports 3 failed | 173 passed - two cases fail on getProfile being called zero
times and the ordering case on calls[0] equal to ["apiConfiguration", undefined]; with the seed in
place it is 176 passed, exit 0. The whole core/webview directory is 34 files and 1073 tests
passing; src tsc --noEmit exit 0; eslint clean on both touched files with their suppressed counts
unchanged (webviewMessageHandler.ts 5, its spec 35, src/eslint-suppressions.json back
byte-identical to its blob at 3298). The compile-job command list in job order is
0,0,0,0,1,1,0,0,0,0,0,0,0: format:check, lint and check-types are green in this worktree, and the
only reds are the two solheim record.sh suites, which need ffprobe and POSIX path separators this
Windows box does not provide. Behaviour change, so the seed is what the reviewer asked for; no
changeset, no CHANGELOG, no suppression change.1 parent eab920d commit aa6037c
2 files changed
Lines changed: 74 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
911 | 911 | | |
912 | 912 | | |
913 | 913 | | |
| 914 | + | |
914 | 915 | | |
915 | 916 | | |
916 | 917 | | |
| |||
933 | 934 | | |
934 | 935 | | |
935 | 936 | | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
936 | 943 | | |
937 | 944 | | |
938 | 945 | | |
| |||
980 | 987 | | |
981 | 988 | | |
982 | 989 | | |
983 | | - | |
984 | | - | |
985 | | - | |
986 | | - | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
987 | 1001 | | |
988 | 1002 | | |
989 | 1003 | | |
| |||
1015 | 1029 | | |
1016 | 1030 | | |
1017 | 1031 | | |
1018 | | - | |
| 1032 | + | |
1019 | 1033 | | |
1020 | 1034 | | |
1021 | 1035 | | |
| |||
1034 | 1048 | | |
1035 | 1049 | | |
1036 | 1050 | | |
1037 | | - | |
1038 | | - | |
1039 | | - | |
1040 | | - | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
1041 | 1058 | | |
1042 | 1059 | | |
1043 | 1060 | | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
1044 | 1080 | | |
1045 | 1081 | | |
1046 | 1082 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
674 | 674 | | |
675 | 675 | | |
676 | 676 | | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
683 | 706 | | |
684 | 707 | | |
685 | 708 | | |
| |||
0 commit comments