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

[PropertyFieldOrder] When items is an empty array, component renders the text "0" #152

Closed
1 of 3 tasks
TheTedAdams opened this issue Jan 30, 2019 · 1 comment
Closed
1 of 3 tasks
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:bug
Milestone

Comments

@TheTedAdams
Copy link

Category

  • Enhancement
  • Bug
  • Question

Version

1.14.0

Expected / Desired Behavior / Question

When passing an empty array to items, the control should render nothing under the label (Or, even nicer, some text stating there are no items)

Observed Behavior

When the items array is empty, the control renders the text "0" under the label.

Steps to Reproduce

Add the control and pass an empty array to items. Observe that the control renders the text "0" where the items would go.

Suggested Resolution

This is another issue of inappropriate use of a truthy/falsey check.

Relevant Code:

(this.state.items && this.state.items.length) && <div

The appropriate check is actually made above on line 52. I remember react used to not render "0" when passed the length of an empty array, so I'm guessing this was written back then and just hasn't been updated.

@AJIXuMuK AJIXuMuK mentioned this issue Nov 5, 2019
@AJIXuMuK AJIXuMuK added status:fixed-next-drop Issue will be fixed in upcoming release. type:bug labels Nov 5, 2019
AJIXuMuK added a commit that referenced this issue Nov 5, 2019
@AJIXuMuK
Copy link
Collaborator

AJIXuMuK commented Nov 5, 2019

Thanks @TheTedAdams !
This has been fixed and will be available in the next released version

@AJIXuMuK AJIXuMuK added this to the 1.16.2 milestone Nov 5, 2019
@estruyf estruyf modified the milestones: 1.16.2, 1.17.0 Nov 25, 2019
@estruyf estruyf closed this as completed Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:bug
Projects
None yet
Development

No branches or pull requests

3 participants