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

Implement emptyText and emptyValue in AutocompleteInput #8162

Merged
merged 37 commits into from
Sep 28, 2022

Conversation

WiXSL
Copy link
Contributor

@WiXSL WiXSL commented Sep 14, 2022

Fixes #8091

  • Implement emptyText usage
  • Add tests
  • Add story
  • Add documentation
  • Add back emptyValue with no support for null or undefined
  • Fix SelectInput's emptyValue docs

@WiXSL WiXSL changed the title Remove emptyValue prop from SelectInput and AutocompleteInput Remove emptyValue and emptyText prop from AutocompleteInput Sep 14, 2022
@fzaninotto
Copy link
Member

We need to keep emptyText

@WiXSL WiXSL added WIP Work In Progress and removed RFR Ready For Review labels Sep 19, 2022
@WiXSL WiXSL changed the title Remove emptyValue and emptyText prop from AutocompleteInput Implement emptyText in AutocompleteInput Sep 19, 2022
WiXSL and others added 2 commits September 23, 2022 11:54
Co-authored-by: Jean-Baptiste Kaiser <jb@marmelab.com>
@@ -458,8 +490,7 @@ If you provided a React element for the optionText prop, you must also provide t
]);

const isOptionEqualToValue = (option, value) => {
// eslint-disable-next-line eqeqeq
return getChoiceValue(option) == getChoiceValue(value);
return getChoiceValue(option) === getChoiceValue(value);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change fixes a test

@@ -342,6 +368,12 @@ If you provided a React element for the optionText prop, you must also provide t
return option?.name;
}

if (!isListItem && option[optionValue || 'id'] === emptyValue) {
Copy link
Contributor Author

@WiXSL WiXSL Sep 26, 2022

Choose a reason for hiding this comment

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

This change prevents the empty choice from getting processed by getRecordRepresentation when isFromReference is true fixing the e2e test

docs/SelectInput.md Outdated Show resolved Hide resolved
Co-authored-by: Jean-Baptiste Kaiser <jb@marmelab.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AutocompleteInput emptyValue prop is ignored
4 participants