Repository navigation
Commit caabac7
committed
fix(webview): retire a confirmed experiment only while the cache still holds it
The confirmation effect gated retirement on one comparison: the live value against the
value this view submitted. The cache copy was never consulted, so a toggle made after the
save - which re-adds the id to the change set and writes the newer value - was overwritten
when the host answer for the earlier value arrived, and its change-set entry was deleted in
the same step. Since the save payload is built by iterating the change set, that next save
then posted nothing for the experiment and the user's newer intent was lost.
Retire the session inside the state updater, which is the only place the authoritative
cached copy is readable: when the cache still equals the submitted value the session ends
and the confirmed live value stands; when it does not, the submitted baseline is retired
while the change-set entry survives, so the next save posts the newer value instead of the
host's older answer. Both ref deletes are idempotent, so React invoking the updater twice
retires the same entries it would retire once - that is what makes the decision safe to
take inside the updater rather than outside it.
Test: keeps a toggle made after the save when the host confirms the earlier value. Against
the previous head it fails with "expected true to be false" on the checkbox; with this fix
the file is 5 tests green on pinned Node 22.23.4 and on box Node 25.9.0, webview-ui
src/components/settings is 61 files / 788 tests, and the package's own leg command
(vitest run --coverage) is 188 files / 2,499 tests with no failing file on 22.23.4.1 parent 710a443 commit caabac7
2 files changed
Lines changed: 61 additions & 11 deletions
File tree
- webview-ui/src/components/settings
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
277 | | - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
278 | 279 | | |
279 | 280 | | |
280 | | - | |
281 | | - | |
| 281 | + | |
| 282 | + | |
282 | 283 | | |
283 | | - | |
| 284 | + | |
284 | 285 | | |
285 | 286 | | |
286 | | - | |
287 | | - | |
288 | | - | |
| 287 | + | |
289 | 288 | | |
| 289 | + | |
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
| 295 | + | |
296 | 296 | | |
297 | | - | |
| 297 | + | |
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
| 301 | + | |
| 302 | + | |
301 | 303 | | |
302 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
303 | 318 | | |
304 | 319 | | |
305 | 320 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
186 | 221 | | |
0 commit comments