Skip to content

Commit

Permalink
fix(Collection): Remove properly device when unselected from the list.
Browse files Browse the repository at this point in the history
Fixes #978
  • Loading branch information
Belphemur authored Aug 8, 2022
1 parent 9546998 commit 2f70eb2
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,14 @@ public bool Remove(T item)
}

var removeId = _byId.Remove(item.Id);
var removeName = _byName.Remove(item.NameClean);
var removeName = _byName.Remove(item.NameClean, out var removedByName);

//If we found it by name, remove it also with it's id
//this avoid the case that a device is removed because of name matching
//but it's still used since we iterate the _byId
if(removeName) {
_byId.Remove(removedByName.Id);
}

return removeId || removeName;
}
Expand Down

0 comments on commit 2f70eb2

Please sign in to comment.