@@ -149,7 +149,10 @@ public partial class AutoFill<TValue>
149149 private List < TValue > ? _filterItems ;
150150
151151 [ NotNull ]
152- private Virtualize < TValue > ? _virtualizeElement = default ;
152+ private Virtualize < TValue > ? _virtualizeElement = null ;
153+
154+ [ NotNull ]
155+ private RenderTemplate ? _dropdown = null ;
153156
154157 /// <summary>
155158 /// Gets the clear icon class string.
@@ -181,13 +184,6 @@ protected override void OnParametersSet()
181184 Items ??= [ ] ;
182185 }
183186
184- private bool _render = true ;
185-
186- /// <summary>
187- /// <inheritdoc/>
188- /// </summary>
189- /// <returns></returns>
190- protected override bool ShouldRender ( ) => _render ;
191187
192188 private bool IsNullable ( ) => ! ValueType . IsValueType || NullableUnderlyingType != null ;
193189
@@ -239,10 +235,7 @@ private async Task OnClickItem(TValue val)
239235
240236 private async ValueTask < ItemsProviderResult < TValue > > LoadItems ( ItemsProviderRequest request )
241237 {
242- _render = false ;
243238 var data = await OnQueryAsync ( new ( ) { StartIndex = request . StartIndex , Count = request . Count , SearchText = _searchText } ) ;
244- _render = true ;
245-
246239 var _totalCount = data . TotalCount ;
247240 var items = data . Items ?? [ ] ;
248241 return new ItemsProviderResult < TValue > ( items , _totalCount ) ;
@@ -261,7 +254,7 @@ public override async Task TriggerFilter(string val)
261254 {
262255 _searchText = val ;
263256 await _virtualizeElement . RefreshDataAsync ( ) ;
264- StateHasChanged ( ) ;
257+ _dropdown . Render ( ) ;
265258 return ;
266259 }
267260
@@ -276,29 +269,17 @@ public override async Task TriggerFilter(string val)
276269 }
277270 else
278271 {
279- var comparision = IgnoreCase ? StringComparison . OrdinalIgnoreCase : StringComparison . Ordinal ;
272+ var comparison = IgnoreCase ? StringComparison . OrdinalIgnoreCase : StringComparison . Ordinal ;
280273 var items = IsLikeMatch
281- ? Items . Where ( i => OnGetDisplayText ? . Invoke ( i ) ? . Contains ( val , comparision ) ?? false )
282- : Items . Where ( i => OnGetDisplayText ? . Invoke ( i ) ? . StartsWith ( val , comparision ) ?? false ) ;
274+ ? Items . Where ( i => OnGetDisplayText ? . Invoke ( i ) ? . Contains ( val , comparison ) ?? false )
275+ : Items . Where ( i => OnGetDisplayText ? . Invoke ( i ) ? . StartsWith ( val , comparison ) ?? false ) ;
283276 _filterItems = [ .. items ] ;
284277 }
285278
286279 if ( ! IsVirtualize && DisplayCount != null )
287280 {
288281 _filterItems = [ .. _filterItems . Take ( DisplayCount . Value ) ] ;
289282 }
290- StateHasChanged ( ) ;
291- }
292-
293- /// <summary>
294- /// Triggers the change method.
295- /// </summary>
296- /// <param name="val">The value to change to.</param>
297- [ JSInvokable ]
298- public Task TriggerChange ( string val )
299- {
300- _displayText = val ;
301- StateHasChanged ( ) ;
302- return Task . CompletedTask ;
283+ _dropdown . Render ( ) ;
303284 }
304285}
0 commit comments