A relation to another entity isn't removed when the target entity is removed. Entity.getRelationsByKind() continues to return removed entities:
with(geary) {
val entityA = entity()
val entityB = entity()
// Using a random component.
entityA.addRelation(components.noInherit, entityB.id)
entityB.removeEntity()
// Throws .-.
check(entityA.getRelationsByKind(components.noInherit).isEmpty())
}
This is disastrous if entity id reuse is enabled.
Additionally, no event is emitted on the entity owning the relation, preventing cleanup without listening to all OnEntityRemoved events and iterating over all entities with that relation (obviously slow).
A relation to another entity isn't removed when the target entity is removed.
Entity.getRelationsByKind()continues to return removed entities:This is disastrous if entity id reuse is enabled.
Additionally, no event is emitted on the entity owning the relation, preventing cleanup without listening to all
OnEntityRemovedevents and iterating over all entities with that relation (obviously slow).