Fix the Autocomplete search rendreding on slow connections (#2820)
This commit is contained in:
Родитель
a396f75104
Коммит
cae754892f
|
@ -3517,6 +3517,7 @@
|
|||
Gets or sets the dialog position:
|
||||
left (full height), right (full height)
|
||||
or screen middle (using Width and Height properties).
|
||||
HorizontalAlignment.Stretch is not supported for this property.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Microsoft.FluentUI.AspNetCore.Components.DialogParameters.Title">
|
||||
|
@ -5675,6 +5676,9 @@
|
|||
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentAutocomplete`1.SelectableItem">
|
||||
<summary />
|
||||
</member>
|
||||
<member name="M:Microsoft.FluentUI.AspNetCore.Components.FluentAutocomplete`1.ShouldRender">
|
||||
<summary />
|
||||
</member>
|
||||
<member name="M:Microsoft.FluentUI.AspNetCore.Components.FluentAutocomplete`1.InputHandlerAsync(Microsoft.AspNetCore.Components.ChangeEventArgs)">
|
||||
<summary />
|
||||
</member>
|
||||
|
@ -13869,6 +13873,11 @@
|
|||
The content is aligned to the end.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:Microsoft.FluentUI.AspNetCore.Components.HorizontalAlignment.Stretch">
|
||||
<summary>
|
||||
The content is stretched to fill the available space.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Microsoft.FluentUI.AspNetCore.Components.HorizontalPosition">
|
||||
<summary>
|
||||
Describes the horizontal positioning of a <see cref="T:Microsoft.FluentUI.AspNetCore.Components.FluentAnchoredRegion"/>.
|
||||
|
|
|
@ -19,6 +19,7 @@ public partial class FluentAutocomplete<TOption> : ListComponentBase<TOption> wh
|
|||
public new FluentTextField? Element { get; set; } = default!;
|
||||
private Virtualize<TOption>? VirtualizationContainer { get; set; }
|
||||
private readonly Debounce _debounce = new();
|
||||
private bool _shouldRender = true;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FluentAutocomplete{TOption}"/> class.
|
||||
|
@ -267,6 +268,9 @@ public partial class FluentAutocomplete<TOption> : ListComponentBase<TOption> wh
|
|||
/// <summary />
|
||||
private TOption? SelectableItem { get; set; }
|
||||
|
||||
/// <summary />
|
||||
protected override bool ShouldRender() => _shouldRender;
|
||||
|
||||
/// <summary />
|
||||
protected override async Task InputHandlerAsync(ChangeEventArgs e)
|
||||
{
|
||||
|
@ -275,6 +279,8 @@ public partial class FluentAutocomplete<TOption> : ListComponentBase<TOption> wh
|
|||
return;
|
||||
}
|
||||
|
||||
_shouldRender = false;
|
||||
|
||||
ValueText = e.Value?.ToString() ?? string.Empty;
|
||||
await RaiseValueTextChangedAsync(ValueText);
|
||||
|
||||
|
@ -312,6 +318,9 @@ public partial class FluentAutocomplete<TOption> : ListComponentBase<TOption> wh
|
|||
{
|
||||
await VirtualizationContainer.RefreshDataAsync();
|
||||
}
|
||||
|
||||
_shouldRender = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private ValueTask<ItemsProviderResult<TOption>> LoadFilteredItemsAsync(ItemsProviderRequest request)
|
||||
|
|
Загрузка…
Ссылка в новой задаче