Repository navigation
[26.8] Fix multiselect chip clear for labeled user profile options - #55140
Open
blakefrain wants to merge 6 commits into
Open
blakefrain wants to merge 6 commits into
blakefrain wants to merge 6 commits into
Conversation
When inputOptionLabels differed from option keys, chip selections used display labels while toggle/remove compared against option keys, so clicking X added the label instead of removing the value. Keep option keys as selections, render labeled chips via chipGroupComponent, and clear multiselect to an empty array. Closes keycloak#55020 Signed-off-by: Cursor Agent <cursoragent@cursor.com>
Closes keycloak#55020 Keycloak omits empty attributes from GET user responses. After clearing a multiselect chip and saving, form.reset rebuilt values without that key, so react-hook-form kept the previous nested value and the chip returned. Seed managed profile attributes with empty values when converting to form fields so reset explicitly clears them. Signed-off-by: Cursor Agent <cursoragent@cursor.com>
Export isRootAttribute from @keycloak/keycloak-ui-shared and use it in toUserFormFields instead of a local duplicate. Closes keycloak#55020 Signed-off-by: Cursor Agent <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #55021 to
release/26.8.Fixes clearing and saving empty values for user profile attributes with
inputType=multiselectwheninputOptionLabelsdiffer from option keys.Root cause
Chip removal used display labels as
selectionswhile toggle/remove compared against option keys, so clicking X could add the label instead of removing the value.After a successful clear, PUT sent an empty array and the server removed the attribute, but GET omits empty attributes.
form.reset(toUserFormFields(user))then rebuilt form state without that key, so react-hook-form kept the previous nested value and the chip reappeared until a hard reload.Fix
Keep option keys as selections and render labels via
chipGroupComponent, clearing multiselect to[].Seed managed profile attributes with empty values in
toUserFormFieldsfrom user profile metadata so reset explicitly clears omitted attributes.Reuse shared
isRootAttributefrom@keycloak/keycloak-ui-shared(no local duplicate).How to verify
Configure an optional multiselect attribute with an options validator,
inputOptionsFromValidation, and labels that differ from keys (max=1).Select a value, save, clear the chip with X, save again — the field should stay empty and save successfully.
Hard refresh should still show an empty selection.
Refs #55020
AI disclosure
This change was produced with assistance from a Cursor cloud agent.