mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 01:48:25 +03:00
Fixed issue where multiple threads were attempting to modify search result list (#761)
* Fixed issue where multiple threads were attempting to modify search result list * Fixed race condition
This commit is contained in:
parent
6263788d6a
commit
8a059e0fbb
2 changed files with 9 additions and 6 deletions
|
@ -75,7 +75,7 @@ namespace Bit.App.Pages
|
|||
{
|
||||
return;
|
||||
}
|
||||
_vm.Search(e.NewTextValue, 500);
|
||||
_vm.Search(e.NewTextValue, 200);
|
||||
}
|
||||
|
||||
private void SearchBar_SearchButtonPressed(object sender, EventArgs e)
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace Bit.App.Pages
|
|||
.GetValueOrDefault();
|
||||
if(!string.IsNullOrWhiteSpace((Page as CiphersPage).SearchBar.Text))
|
||||
{
|
||||
Search((Page as CiphersPage).SearchBar.Text, 500);
|
||||
Search((Page as CiphersPage).SearchBar.Text, 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,16 +110,19 @@ namespace Bit.App.Pages
|
|||
}
|
||||
catch(OperationCanceledException)
|
||||
{
|
||||
ciphers = new List<CipherView>();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(ciphers == null)
|
||||
{
|
||||
ciphers = new List<CipherView>();
|
||||
}
|
||||
Ciphers.ResetWithRange(ciphers);
|
||||
ShowNoData = searchable && Ciphers.Count == 0;
|
||||
ShowList = searchable && !ShowNoData;
|
||||
Device.BeginInvokeOnMainThread(() =>
|
||||
{
|
||||
Ciphers.ResetWithRange(ciphers);
|
||||
ShowNoData = searchable && Ciphers.Count == 0;
|
||||
ShowList = searchable && !ShowNoData;
|
||||
});
|
||||
}, cts.Token);
|
||||
_searchCancellationTokenSource = cts;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue