Skip to content
This repository was archived by the owner on Jun 28, 2026. It is now read-only.

Fix value prop to keep SelectInput's input as controlled#8048

Merged
melloware merged 2 commits into
primefaces:masterfrom
rubenochiavone:fix/uncontrolled-multiselect-input
May 28, 2025
Merged

Fix value prop to keep SelectInput's input as controlled#8048
melloware merged 2 commits into
primefaces:masterfrom
rubenochiavone:fix/uncontrolled-multiselect-input

Conversation

@rubenochiavone

Copy link
Copy Markdown
Contributor

Fixes #7896.

@github-actions

Copy link
Copy Markdown

Thanks a lot for your contribution! But, PR does not seem to be linked to any issues. Please manually link to an issue or mention it in the description using #<issue_id>.

};

const getLabel = () => {
let label;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

label was always undefined and when getLabel didn't get to inner block (!empty && !props.fixedPlaceholder), the returned value would be undefined causing the input's prop value to also be undefined. That led to react thinking the input was uncontrolled. Afterwards, if anything changes the input's prop value to be non-undefined, react will trigger the uncontrolled to controlled warning.

@rubenochiavone rubenochiavone force-pushed the fix/uncontrolled-multiselect-input branch from 80f8ba1 to 9461ace Compare May 28, 2025 02:12
@github-actions

Copy link
Copy Markdown

Thanks a lot for your contribution! But, PR does not seem to be linked to any issues. Please manually link to an issue or mention it in the description using #<issue_id>.

@rubenochiavone rubenochiavone changed the title Fix value prop to keep SelectInput input as controllable Fix value prop to keep SelectInput's input as controlled May 28, 2025
@github-actions

Copy link
Copy Markdown

Thanks a lot for your contribution! But, PR does not seem to be linked to any issues. Please manually link to an issue or mention it in the description using #<issue_id>.

@github-actions

Copy link
Copy Markdown

Thanks a lot for your contribution! But, PR does not seem to be linked to any issues. Please manually link to an issue or mention it in the description using #<issue_id>.

@melloware melloware added the Type: Bug Issue contains a defect related to a specific component. label May 28, 2025
@melloware melloware merged commit 633929b into primefaces:master May 28, 2025
1 of 2 checks passed
@rubenochiavone rubenochiavone deleted the fix/uncontrolled-multiselect-input branch May 28, 2025 02:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Type: Bug Issue contains a defect related to a specific component.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MultiSelect: A component is changing an uncontrolled input to be controlled.

2 participants