You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[v2] Expose the previous value to change listeners #2301
onChange listeners may need to compare the current form value with the value immediately before the change. The listener context could support this by exposing an optional prevValue property:
prevValue?: TData
For a change event, prevValue would contain the value before that change was applied. It would not be present for other listener events.
Debounced listeners
The previous value should correspond to the specific change that ultimately invokes the listener. For example, if a debounced change listener receives five changes in quick succession, the callback would run after the timeout with the fourth value as prevValue and the fifth as the current value.
Some thoughts
setFieldValue and handleChange could capture the previous value and pass that snapshot through the listener context. The property needs to remain optional because the shared listener context is also used by events that are not change events.
Activity