mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Improve remove logic
This commit is contained in:
parent
c49b3b7cba
commit
58b9f0c19c
1 changed files with 7 additions and 4 deletions
|
|
@ -190,13 +190,16 @@ namespace Flow.Launcher.Storage
|
|||
|
||||
// remove the record from the bag
|
||||
var bag = new ConcurrentQueue<Record>(value.Where(r => !r.Equals(result)));
|
||||
records[result.OriginQuery.RawQuery] = new ConcurrentBag<Record>(bag);
|
||||
|
||||
// if the bag is empty, remove the bag from the dictionary
|
||||
if (value.IsEmpty)
|
||||
if (bag.IsEmpty)
|
||||
{
|
||||
// if the bag is empty, remove the bag from the dictionary
|
||||
records.TryRemove(result.OriginQuery.RawQuery, out _);
|
||||
}
|
||||
else
|
||||
{
|
||||
// change the bag in the dictionary
|
||||
records[result.OriginQuery.RawQuery] = new ConcurrentBag<Record>(bag);
|
||||
}
|
||||
}
|
||||
|
||||
internal void AddOrUpdate(Result result)
|
||||
|
|
|
|||
Loading…
Reference in a new issue