frontend-collective / frontend-collective/react-sortable-tree

Error: "No suitable position found to insert" with getNodeKey specified and canDrop returning false

Open
#259 7 comments 0 reactions 0 assignees View on GitHub
bug investigate
Dominant language
JavaScript
Stars
5k
Forks
914
PR merge metrics
No merged PRs in 30d

Description

I am receiving the error "No suitable position found to insert" when performing a very specific drag under a very specific conditions.

As far as I can tell, the key conditions are as follows:

* getNodeKey must be specified.
* There must be 3 top level nodes.
* The second node must have three levels of children, all of which must be expanded.
* The third node must have at least one child, and must not be expanded.
* canDrop must sometimes return false. I had a very complex condition when I first encountered this problem, but in theory the tree should never fire an error even if canDrop always returns false.

You can find a reproduction of these conditions [in this sandbox](https://codesandbox.io/s/8nmw11vo40)

Just drag Y under X and you will get the error.

Please note that this problem wasn't present in version 1.5.0 but is present in both 1.7.0 and 2.0.1.

The error is the same as [this other issue](https://github.com/fritz-c/react-sortable-tree/issues/105) but the conditions for causing it are completely different so it is likely to be a different problem -- also this issue does not require a quick succession of actions in order to replicate it. This is the reason why I have opened a different issue.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.