Endless remove loop when trying to remove from Selector selected Item
bennoinbeta opened this issue Β· comments
π Bug report
π€ Current Behavior
When we remove an Item that is currently selected by a Selector,
the remove method calls 'reselect' on the affected Selectors
to hold a reference to the now defunct Item. (-> Selector creates placeholder Item)
// ..
// Remove Item from Collection
delete this.data[itemKey];
// Reselect Item in Selectors (to create new dummyItem that holds reference)
for (const selectorKey in this.selectors) {
const selector = this.getSelector(selectorKey, { notExisting: true });
if (selector?.hasSelected(itemKey)) selector?.reselect({ force: true });
}
// ..
And when we now try to remove the placeholder Item,
it won't work because the Selector needs to hold a reference to it.
This is an expected behavior, but it shouldn't cause a rerender on each 'placeholder' Item remove try.
π― Expected behavior
Doesn't remove required placeholder Item and create it again with a rerender as side effect.