Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Endless remove loop when trying to remove from Selector selected Item #151

@bennobuilder

Description

@bennobuilder

🐛 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions