Skip to content

Commit

Permalink
Fix default value for icon-image categorization
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo-Duke committed Jul 11, 2023
1 parent 862ff42 commit a59bfde
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const CategorizeValue = ({
getValuesOfProperty,
Component,
defaultValueGenerator,
hasDefaultValue,
}) => {
const translate = useTranslate();
const mountedRef = React.useRef(true);
Expand All @@ -86,7 +87,8 @@ const CategorizeValue = ({
React.useEffect(() => {
const getValueList = async () => {
setTooManyValues(false);
const result = await getValuesOfProperty(field);
const resultRaw = await getValuesOfProperty(field);
const result = hasDefaultValue ? [null, ...resultRaw] : resultRaw;

if (!mountedRef.current) return;

Expand Down Expand Up @@ -122,6 +124,7 @@ const CategorizeValue = ({
setValueList,
valueList,
valuesLoaded,
hasDefaultValue,
]);

const onSortEnd = ({ oldIndex, newIndex }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const IconStyleField = ({
getValuesOfProperty={getValuesOfProperty}
Component={Component}
defaultValueGenerator={genDefaultValue}
hasDefaultValue
/>
</Condition>
</>
Expand Down

0 comments on commit a59bfde

Please sign in to comment.