react-sortablejs icon indicating copy to clipboard operation
react-sortablejs copied to clipboard

removeOnSpill just cause Failed to execute 'insertBefore' on 'Node':

Open lidasong opened this issue 5 years ago • 2 comments

when set removeOnSpill and remove from the sortable list, and then add one the the list . then just cause error Failed to execute 'insertBefore' on 'Node':

lidasong avatar May 23 '20 07:05 lidasong

Hi @lidasong

Did you find a solution about this problem?

onur-ozguzel avatar Aug 31 '20 13:08 onur-ozguzel

because onSpill doesn't call prop's setList, so the prop's list doesn't match the dom's list.

`<ReactSortable
        list={value}
        setList={onChange}
        animation={200}
        group={group}
        removeOnSpill={true}
        onSpill={evt => {
          const toRemoved = value[evt.oldIndex as number];
          onChange(value.filter(item => item !== toRemoved));
        }}>
        {value.map(item => (
          <div key={item.id} className={cx({ item: true, [item.from]: true })}>
            {item.caption}
          </div>
        ))}
      </ReactSortable>`

tobemaster56 avatar Dec 02 '20 08:12 tobemaster56