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

ui/taxonomy: CustomSelect isClearable - handle empty string selection #1712

Merged
merged 3 commits into from
Nov 10, 2022

Conversation

ssangervasi
Copy link
Contributor

@ssangervasi ssangervasi commented Nov 8, 2022

Closes #1504

Code Changes

  • Use isClearable during onChange in forms.
  • Apply this to taxonomy Data Use

Steps to Confirm

Pre-Merge Checklist

  • All CI Pipelines Succeeded
  • Documentation Updated:
    • documentation complete, or draft/outline provided (tag docs-team to complete/review on this branch)
    • documentation issue created (tag docs-team to complete issue separately)
  • Issue Requirements are Met
  • Relevant Follow-Up Issues Created
  • Update CHANGELOG.md

Description Of Changes

The single-select clearing functionality already existed, but we hadn't tried it anywhere. The only thing it was missing was assigning the value to a "cleared" value. react-select doesn't want to use null or undefined for this state, which is reasonable since the native HTML way of doing it is to set an empty string (whenever the value would not match one of the option elements).

This empty-string case then needs to be handled when transforming the form into an object to submit to the server.

I looked for other uses of CustomSelect where the value should be clearable, but they all seemed required to me. For example, submitting a null/undefined/empty-string data_qualifier is not accepted by the server.

clearing

Copy link
Contributor

@LKCSmith LKCSmith left a comment

Choose a reason for hiding this comment

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

👍

@ssangervasi ssangervasi merged commit 73bba0e into main Nov 10, 2022
@ssangervasi ssangervasi deleted the ssangervasi/fides-1504/single-select-clear branch November 10, 2022 00:16
ssangervasi added a commit that referenced this pull request Nov 10, 2022
…#1712)

* ui/taxonomy: CustomSelect isClearable - handle empty string selection

* ui/cy: Test clearing single select taxonomy

* Update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow single select lists to be cleared in Taxonomy management
3 participants