Skip to content

AsyncValidator Unexpected Behavior #27

Description

@aliaksei-liavonik

Hi,

I've encountered unexpected behavior when using asyncValidator. Specifically:

  • When asyncValidator is used, it updates the state of FieldCubit multiple times with different statuses, which is expected.
  • However, if setValue is called during an ongoing async validation, and state.autovalidate is true, the synchronous _validator (which does not perform async calculations) is triggered.
  • This causes the state to be updated with the new value.
  • When the asyncValidator completes, it overrides the FieldCubit state with the previous value, leading to unexpected behavior.

Expected Behavior:
If a new value is set while an async validation is in progress, any ongoing async state updates in FieldCubit should be canceled to prevent the state from reverting to an outdated value

I'm happy to provide more details or contribute to resolving this issue if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions