-
Notifications
You must be signed in to change notification settings - Fork 214
[bug] Migrating from 1.5.1 to 1.6.0 resulting in some weirdness #185
New issue
Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? No Sign in to your account
Comments
Thank you for the report and the CodeSandbox project! For Issue Number 1, the default is still leaf. I am not sure how it would be defaulting to For Issue Number 2, in hindsight I admit that this change from previous behavior probably warranted a semver major update. Unfortunately, I did not consider that when I accepted the PR because it made sense to treat any node with an empty Per your last point, I did not realize that empty folders were getting checked. I looked at the PR's tests, and they seemed okay. I should have rendered an example in the browser to see how it panned out; that is a big mistake on my part and the current behavior is confusing to users. The empty parent nodes only appear checked because of how the check algorithm works. I can add simple test in case they have no children, but that still leaves the checkbox open for interaction when logically there is nothing to really check (when |
I suggest that allowing a user to check/uncheck an empty node is an acceptable behavior. Consider the case of a file-manager. Being able to 'check' an empty folder would be required for being able to mark an empty folder for copy/delete etc |
Chiming in here to say that this should definitely be a semver major update. We optimistically create the children array when building our data structure expecting the node to behave as a leaf if the array is empty. Updating to 1.6.0 broke our build. |
I'm having some difficulty in migrating from 1.5.1 to 1.6.0.
I have resolved two separate issues that I will outline for anyone else that might get caught out by breaking changes in this PR.
Number 1: #13
This issue adds support for 'checkModel' with modes 'all' or 'leaf'.
checkModel="leaf"
to the component resolves thisNumber 2: #171
This issue adds support for empty folders.
But now I'm getting some weirdness, and this is where the 'bug report' aspect of things begins:
checkModel="leaf"
setAs a result of this, when I have an empty folder nested somewhere in my structure and I initialize the component with an empty
checked
array, these empty folders are becoming checked somehow.I will repeat for clarity. My
checked
array is empty, but the "empty-children" "non-leaf" nodes are defaulting to checked.Screenshots
Default state, just after loading.

checked
array is emptySame state as above, just "drilled down" to the offending elements

For clarity (since I have to remove the labels) the first and third nodes are expanded showing no children inside them. The second node also has no children, but is not expanded. The fourth node has children and is expanded. This is all with an empty
checked
array andcheckModel="leaf"
The text was updated successfully, but these errors were encountered: