Commit 647febb
Issue: FormSpy was throwing "Cannot set property active" error when using
subscription to 'active' field in v7.0.0.
Root cause: In the TypeScript migration (commit 875f4ce), the FormSpy component
started spreading the lazy state object into renderProps. The lazy state object
has getter-only properties defined by addLazyFormState(), which makes them
read-only. Spreading these properties into a new object causes JavaScript to
attempt to set them, which fails because they have no setter.
Fix: Remove ...state from renderProps. The state is already passed separately
to renderComponent() as lazyProps parameter, which correctly handles the
getter-only properties using Object.defineProperties().
Test: Added test case that verifies FormSpy with subscription to 'active' and
'values' renders without error and can access these properties correctly.
Co-authored-by: Erik Rasmussen <erik@mini.local>
1 parent 0a1c4dc commit 647febb
2 files changed
Lines changed: 43 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
419 | 462 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
0 commit comments