Skip to content

bug(AutoComplete): studder on long running OnValueChanged function call #5812

@celadaris

Description

@celadaris

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When typing on an AutoComplete Component that has a long running function attached to the OnValueChanged attribute, the value of the component is overwritten by an older value of the component causing a unpleasant studder/bad user experience.

A good example of this happening is when running queries.

Expected Behavior

There shouldnt be any studders and text should never overwrite what the user typed, unless an item was selected in the dropdown or after the blur event.

Interactive render mode

Interactive Server (Interactive server-side rendering (interactive SSR) using Blazor Server)

Steps To Reproduce

<h1>@testValue</h1>

<AutoComplete OnValueChanged="hello" OnEnterAsync="hello"></AutoComplete>

<Button Text="TestBtn" OnClick="@(() => hello("hi"))"></Button>

@code {
    int testValue = 0;

    async Task hello(string value)
    {
        await Task.Delay(500);
        testValue++;

        await InvokeAsync(StateHasChanged);
    }
}

Exceptions (if any)

No response

.NET Version

NET9.0

Anything else?

2025-04-11.12-43-38.mp4

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions