Skip to content

Commit

Permalink
šŸ› fix(GlobalNavigation): entered text cannot be displayed during searā€¦
Browse files Browse the repository at this point in the history
ā€¦ching (#693)
  • Loading branch information
capdiem committed May 13, 2024
1 parent dd3f526 commit cc9637b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<div class="d-flex">
<span class="global-nav-header__title">@T("GlobalNavigation")</span>
<MSpacer />
<SSearch Dense Class="mr-6" ValueChanged="SearchChanged" />
<SSearch Dense Class="mr-6" Value="@_search" ValueChanged="SearchChanged" />
<MButton Icon OnClick="() => _visible = false">
<MIcon>mdi-close</MIcon>
</MButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ public partial class GlobalNavigation : MasaComponentBase
[Parameter]
public Func<string, Task>? OnFavoriteRemove { get; set; }

bool _visible;
private bool _visible;
private List<(string name, string url)>? _recentVisits;
private List<KeyValuePair<string, string>>? _recommendApps;
private List<ExpansionMenu>? _favorites;
ExpansionMenu? _menu;
private ExpansionMenu? _menu;
private string? _search;

private async Task GetMenuAndFavorites()
{
Expand Down Expand Up @@ -50,18 +51,24 @@ private async Task GetRecommendApps()

private void VisibleChanged(bool visible)
{
if (visible && _menu == null)
if (visible)
{
_ = GetRecommendApps();
_ = GetRecentVisits();
_ = GetMenuAndFavorites();
SearchChanged(null);

if (_menu == null)
{
_ = GetRecommendApps();
_ = GetRecentVisits();
_ = GetMenuAndFavorites();
}
}

_visible = visible;
}

private void SearchChanged(string? search)
{
_search = search;
_menu?.SetHiddenBySearch(search, TranslateProvider);
}

Expand Down

0 comments on commit cc9637b

Please sign in to comment.