Commit 41ece29
Erik Rasmussen
Fix #1055: Remove spreading of lazy state in FormSpy renderProps
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.1 parent 0a1c4dc commit 41ece29
4 files changed
Lines changed: 22151 additions & 1481 deletions
0 commit comments