Fix local sorting calls an online request

This commit is contained in:
Andrei Zavatski 2019-09-19 03:35:56 +03:00
parent 9a81a44134
commit 44412f9ddb

View File

@ -70,7 +70,7 @@ namespace osu.Game.Overlays
Header.Tabs.Current.ValueChanged += _ => queueUpdate(); Header.Tabs.Current.ValueChanged += _ => queueUpdate();
Filter.Tabs.Current.ValueChanged += _ => queueUpdate(); Filter.Tabs.Current.ValueChanged += _ => onFilterUpdate();
Filter.DisplayStyleControl.DisplayStyle.ValueChanged += style => recreatePanels(style.NewValue); Filter.DisplayStyleControl.DisplayStyle.ValueChanged += style => recreatePanels(style.NewValue);
Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => updateUsers(Users); Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => updateUsers(Users);
@ -180,6 +180,17 @@ namespace osu.Game.Overlays
}, loadCancellation.Token); }, loadCancellation.Token);
} }
private void onFilterUpdate()
{
if (Users == null || Filter.Tabs.Current.Value == SocialSortCriteria.Rank)
{
queueUpdate();
return;
}
updateUsers(Users);
}
private void updateUsers(IEnumerable<User> newUsers) private void updateUsers(IEnumerable<User> newUsers)
{ {
var sortDirection = Filter.DisplayStyleControl.Dropdown.Current.Value; var sortDirection = Filter.DisplayStyleControl.Dropdown.Current.Value;