Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “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? Sign in to your account

[Bug Report] v-treeview : Expand icon displayed for empty children array #5357

Closed
mgiraud opened this issue Oct 19, 2018 · 3 comments · Fixed by #5442
Closed

[Bug Report] v-treeview : Expand icon displayed for empty children array #5357

mgiraud opened this issue Oct 19, 2018 · 3 comments · Fixed by #5442
Assignees
Labels
pending review The issue is still pending disposition S: has PR The issue has a pending Pull Request
Milestone

Comments

@mgiraud
Copy link

mgiraud commented Oct 19, 2018

Versions and Environment

Vuetify: 1.3.0
Vue: 2.5.17
Browsers: Firefox
OS: Mac

Steps to reproduce

Create a tree with categories which children exist but is an empty array

Expected Behavior

The expand icon should not be generated

Actual Behavior

The expand icon is generated

Possible fix:

File: VTreeviewNode.ts L221

      if (this.children) children.unshift(this.genToggle())
      if (this.children && this.children.length > 0) children.unshift(this.genToggle())
@mgiraud mgiraud changed the title v-treeview : Expand icon displayed for empty children array [Bug Report] v-treeview : Expand icon displayed for empty children array Oct 19, 2018
@jacekkarczmarczyk
Copy link
Member

Please provide runnable minimal reproduction

@jacekkarczmarczyk jacekkarczmarczyk added the S: needs reproduction The issue does not contain a valid reproduction label Oct 19, 2018
@nekosaur
Copy link
Member

Items with a children property that is an empty array can be expanded and get children with the load-children prop. So checking only children length won't work. We could possibly do this.children && (this.children.length || this.loadChildren) so that toggle is only rendered if one has supplied a load-function callback.

@mgiraud
Copy link
Author

mgiraud commented Oct 19, 2018

Minimal reproduction on codepen : https://codepen.io/anon/pen/pxVVJE

@jacekkarczmarczyk jacekkarczmarczyk removed the S: needs reproduction The issue does not contain a valid reproduction label Oct 19, 2018
@johnleider johnleider added the pending review The issue is still pending disposition label Oct 21, 2018
@johnleider johnleider added this to the v1.3.x milestone Oct 21, 2018
nekosaur added a commit that referenced this issue Oct 26, 2018
changed logic for rendering expand icon to only show when children
actually has items, or load-children prop is used

fixes #5357
@johnleider johnleider added S: has PR The issue has a pending Pull Request and removed S: work in progress labels Oct 26, 2018
nekosaur added a commit that referenced this issue Nov 11, 2018
changed logic for rendering expand icon to only show when children
actually has items, or load-children prop is used

fixes #5357
johnleider pushed a commit that referenced this issue Nov 12, 2018
* fix(v-treeview): expand icon on empty children

changed logic for rendering expand icon to only show when children
actually has items, or load-children prop is used

fixes #5357

* test: added tests

* refactor: added hasChildren boolean
@lock lock bot locked as resolved and limited conversation to collaborators Nov 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pending review The issue is still pending disposition S: has PR The issue has a pending Pull Request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants