Skip to content

Async validation with debounce not working on initial keystroke of an empty input #9067

Description

@ark-carlosmarch

Dependencies check up

  • I have verified that I use latest version of all @mantine/* packages

What version of @mantine/* packages do you have in package.json?

9.2.1

What package has an issue?

@mantine/form

What framework do you use?

Vite

In which browsers you can reproduce the issue?

All

Describe the bug

I had some custom debounce code, and I'm trying to simplify the logic by using the new async/debounce validation in Mantine 9.

However, I have noticed that when I start typing on an empty input, the debounce seems to not be working. I don't get a request on every keystroke, but maybe once every 2 keystrokes.

Once the input has some text, if I delete some characters, or add more, the debounce works properly and only triggers once I stop typing. If I delete all characters in the input, and then start typing again, I get the issue again.

If possible, include a link to a codesandbox with a minimal reproduction

https://codesandbox.io/p/sandbox/mantine-react-template-forked-y6n8gv

Possible fix

No response

Self-service

  • I would be willing to implement a fix for this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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