Skip to content

Commit c2dc189

Browse files
authored
fix(blazorui): resolve issues of state changes in BitSearchBox #10928 (#10932)
1 parent bf631f1 commit c2dc189

File tree

1 file changed

+32
-31
lines changed

1 file changed

+32
-31
lines changed

src/BlazorUI/Bit.BlazorUI/Components/Inputs/SearchBox/BitSearchBox.razor.cs

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -383,36 +383,6 @@ private void SetInputMode()
383383
_inputMode = InputMode?.ToString().ToLower();
384384
}
385385

386-
private async Task ToggleCallout()
387-
{
388-
if (IsEnabled is false || IsDisposed) return;
389-
390-
await _js.BitCalloutToggleCallout(_dotnetObj,
391-
_Id,
392-
null,
393-
_calloutId,
394-
null,
395-
_isOpen,
396-
BitResponsiveMode.None,
397-
BitDropDirection.TopAndBottom,
398-
Dir is BitDir.Rtl,
399-
_scrollContainerId,
400-
0,
401-
string.Empty,
402-
string.Empty,
403-
true);
404-
}
405-
406-
private async Task CloseCallout()
407-
{
408-
if (IsEnabled is false) return;
409-
410-
_isOpen = false;
411-
await ToggleCallout();
412-
413-
StateHasChanged();
414-
}
415-
416386
private async Task SearchItems()
417387
{
418388
if (CurrentValue.HasNoValue() || CurrentValue!.Length < MinSuggestTriggerChars)
@@ -454,15 +424,46 @@ private async Task OpenOrCloseCallout()
454424
{
455425
_isOpen = true;
456426
await ToggleCallout();
457-
StateHasChanged();
458427
}
428+
429+
StateHasChanged();
459430
}
460431
else
461432
{
462433
await CloseCallout();
463434
}
464435
}
465436

437+
private async Task CloseCallout()
438+
{
439+
if (IsEnabled is false) return;
440+
441+
_isOpen = false;
442+
await ToggleCallout();
443+
444+
StateHasChanged();
445+
}
446+
447+
private async Task ToggleCallout()
448+
{
449+
if (IsEnabled is false || IsDisposed) return;
450+
451+
await _js.BitCalloutToggleCallout(_dotnetObj,
452+
_Id,
453+
null,
454+
_calloutId,
455+
null,
456+
_isOpen,
457+
BitResponsiveMode.None,
458+
BitDropDirection.TopAndBottom,
459+
Dir is BitDir.Rtl,
460+
_scrollContainerId,
461+
0,
462+
string.Empty,
463+
string.Empty,
464+
true);
465+
}
466+
466467
private async Task ChangeSelectedItem(bool isArrowUp)
467468
{
468469
if (_isOpen is false) return;

0 commit comments

Comments
 (0)