Skip to content

store: Make sure we don't add individuals twice

Niels De Graef requested to merge nielsdg/link-duplicate-contacts into main

An individual can appear several times in the changes argument of the IndividualAggregator's individuals-changed-detailed signal, in the case of linking. When 2 Individuals are linked -let's call them A and B- into a single Individual C, then the signal will be emitted with the following map:

A -> C
B -> C

In other words, C will show up twice in the list of values. Since we weren't checking whether an individual already existed before adding it to the to_add list, duplicates were a possibility. This should no longer be the case (and from a quick check, it doesn't have any non-negligible performance impact either).

Partially fixes: #247

Merge request reports