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

MultiSelect treats a value of zero for maxSelectedLabels as null #2966

Closed
nathan-seddig-techedge opened this issue Jun 6, 2022 · 1 comment · Fixed by #2968
Closed

MultiSelect treats a value of zero for maxSelectedLabels as null #2966

nathan-seddig-techedge opened this issue Jun 6, 2022 · 1 comment · Fixed by #2968
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@nathan-seddig-techedge
Copy link

Describe the bug

I upgraded primereact from version 6.6.0 to version 8.0.0 and now setting the maxSelectedLabels of a MultiSelect to 0 appears to be equivalent to setting it to null, which causes all selected options to be displayed. Before the upgrade it caused the number of selected options to always be displayed, regardless of the selection. I believe this to be a bug and whish that the old behaviour, distinguishing between 0 and null, would be restored.

Reproducer

https://codesandbox.io/s/primereact-test-forked-77x2o7

PrimeReact version

8.1.1

React version

17.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Create a MultiSelect component
  2. Set maxSelectedLabels={0}
  3. Open the page and select an option
  4. The name of the selected option(s) is displayed instead of the number of selected options

Expected behavior

When maxSelectedLabels is set to 0, the number of selected options should always be displayed, including in the case in which no option is selected.

@nathan-seddig-techedge nathan-seddig-techedge added Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Type: Bug Issue contains a defect related to a specific component. labels Jun 6, 2022
@melloware
Copy link
Member

Thanks for reporting I will take a look!

melloware added a commit to melloware/primereact that referenced this issue Jun 6, 2022
@melloware melloware removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jun 6, 2022
@melloware melloware added this to the 8.2.0 milestone Jun 6, 2022
@melloware melloware self-assigned this Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants