Fix regression that prevented custom placeholders from working (#9994)

This commit is contained in:
Andrew Kingston 2023-03-20 09:12:50 +00:00 committed by GitHub
parent 7ee305231d
commit 8eaba806d4
1 changed files with 6 additions and 2 deletions

View File

@ -42,9 +42,13 @@
}
const getFieldText = (value, options, placeholder) => {
// Always use placeholder if no value
if (value == null || value === "") {
return placeholder !== false ? "Choose an option" : ""
// Explicit false means use no placeholder and allow an empty fields
if (placeholder === false) {
return ""
}
// Otherwise we use the placeholder if possible
return placeholder || "Choose an option"
}
return getFieldAttribute(getOptionLabel, value, options)