-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit d043454
fix(docsite): bridge Selector's onChange preview even without a seeded value (#6035)
PR #5909 seeded `options`/`label` playground defaults for Selector so its
Properties preview stops showing the "missing required props" placeholder,
but did not seed `value` (correctly: Selector's own contract requires
"closed with no value" to be a valid representative state, FR1 in
Selector.spec.md). That exposed a latent bug in
`buildRuntimePreviewState`: it only bridges a controlled callback back into
playground state when its target prop already has a value in `state`, so
Selector's `onChange` was never wired up and the live preview stayed frozen
on the placeholder no matter what option a person clicked.
Fix generalizes the bridge instead of papering over Selector specifically:
the literal `value`/`onChange` pair — a component's one primary controlled
value — now bridges whenever `target` names a real prop, even an optional
one with no seeded default. Secondary paired callbacks (onIndexChange,
onPageSizeChange, onOpenChange, ...) keep the original opt-in behavior,
preserving each preview's chosen representative starting state (verified by
the existing Lightbox gallery-index and overlay tests, unchanged and still
passing).
Added a focused regression test reproducing the exact reported scenario:
Selector with options seeded but no value, selecting Orange must update
preview state.
Testing:
- New test: bridges Selector onChange even though its optional value prop
is not seeded (red before the fix, green after)
- Full docsite suite: 34 files, 475 tests passing
- tsc --noEmit: no new errors (pre-existing theme-package /built errors are
unrelated to this worktree's unbuilt theme packages)
- eslint on both changed files: clean
- check:package-boundaries: clean
Excludes all work from #5963 (unrelated theme appearance-nesting tokens);
touches only docsite preview infrastructure and its test.1 parent 75a4d1d commit d043454
2 files changed
Lines changed: 46 additions & 8 deletions
File tree
- apps/docsite/src
- __tests__
- components/component-detail
Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
447 | + | ||
448 | + | ||
449 | + | ||
450 | + | ||
451 | + | ||
452 | + | ||
453 | + | ||
454 | + | ||
455 | + | ||
456 | + | ||
457 | + | ||
458 | + | ||
459 | + | ||
460 | + | ||
461 | + | ||
462 | + | ||
463 | + | ||
464 | + | ||
465 | + | ||
466 | + | ||
467 | + | ||
468 | + | ||
469 | + | ||
470 | + | ||
471 | + | ||
472 | + | ||
473 | + | ||
447 | 474 | | |
448 | 475 | | |
449 | 476 | | |
| |||
Lines changed: 19 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | - | ||
296 | + | ||
297 | + | ||
298 | + | ||
297 | 299 | | |
298 | 300 | | |
299 | 301 | | |
300 | 302 | | |
301 | 303 | | |
304 | + | ||
302 | 305 | | |
303 | 306 | | |
304 | - | ||
307 | + | ||
308 | + | ||
309 | + | ||
310 | + | ||
305 | 311 | | |
306 | 312 | | |
307 | - | ||
313 | + | ||
314 | + | ||
315 | + | ||
308 | 316 | | |
309 | 317 | | |
310 | 318 | | |
311 | 319 | | |
312 | 320 | | |
313 | - | ||
314 | - | ||
315 | - | ||
321 | + | ||
322 | + | ||
323 | + | ||
324 | + | ||
316 | 325 | | |
317 | 326 | | |
318 | 327 | | |
| |||
330 | 339 | | |
331 | 340 | | |
332 | 341 | | |
342 | + | ||
343 | + | ||
333 | 344 | | |
334 | 345 | | |
335 | 346 | | |
336 | - | ||
347 | + | ||
337 | 348 | | |
338 | 349 | | |
339 | 350 | | |
| |||
342 | 353 | | |
343 | 354 | | |
344 | 355 | | |
345 | - | ||
356 | + | ||
346 | 357 | | |
347 | 358 | | |
348 | 359 | | |
| |||
0 commit comments