Skip to content

[v2] Expose the previous value to change listeners #2301

Description

@LeCarbonator

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

  1. added
    type: enhancementThis requests an enhancement to existing behaviour.
    v2This issue affects v2 as well.
    scope: coreThis issue affects the core package, meaning any adapter is also affected by it.
    area: runtimeThis issue affects the runtime of the library.
    area: typesThis issue affects the types of the library.
    on Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: runtimeThis issue affects the runtime of the library.area: typesThis issue affects the types of the library.scope: coreThis issue affects the core package, meaning any adapter is also affected by it.type: enhancementThis requests an enhancement to existing behaviour.v2This issue affects v2 as well.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions