Added Task.Yield call to category top tagging portion.

This commit is contained in:
Harrison Deng 2021-05-21 22:53:56 -05:00
parent 6c684372df
commit d5c89fa6ca

View File

@ -131,11 +131,14 @@ namespace MultiShop.Client.Pages
searching = false; searching = false;
searched = true; searched = true;
int tagsAdded = 0;
foreach (ResultsProfile.Category c in greatest.Keys) foreach (ResultsProfile.Category c in greatest.Keys)
{ {
foreach (ProductListingInfo info in greatest[c]) foreach (ProductListingInfo info in greatest[c])
{ {
info.Tops.Add(c); info.Tops.Add(c);
tagsAdded += 1;
if (tagsAdded % 50 == 0) await Task.Yield();
} }
} }
@ -147,7 +150,7 @@ namespace MultiShop.Client.Pages
if (searching) return; if (searching) return;
organizing = true; organizing = true;
StateHasChanged(); StateHasChanged();
List<ProductListingInfo> sortedResults = await Task.Run<List<ProductListingInfo>>(() => List<ProductListingInfo> sortedResults = await Task.Run<List<ProductListingInfo>>(() =>
{ {
List<ProductListingInfo> sorted = new List<ProductListingInfo>(listings); List<ProductListingInfo> sorted = new List<ProductListingInfo>(listings);