Skip to content

Commit

Permalink
Prevent crash if invalid field configuration
Browse files Browse the repository at this point in the history
Ensure that if fieldValues.valueSet.value is not a string, we fallback to an empty array to avoid application crash

Was unable to reproduce the report situation, so not sure exactly what the root cause is

resolves #936
  • Loading branch information
paustint committed Jun 19, 2024
1 parent 0196162 commit 30bfd8c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions libs/shared/ui-core/src/create-fields/create-fields-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -866,11 +866,12 @@ function prepareFieldPayload(sobject: string, fieldValues: FieldValues, orgNames
valueSetDefinition: {
sorted: false,
// sorted: fieldValues.sorted.value,
value: (fieldValues.valueSet.value as string).split('\n').map((value, i) => ({
fullName: value,
label: value,
default: fieldValues.firstAsDefault.value && i === 0,
})),
value:
(fieldValues.valueSet.value as string)?.split('\n').map((value, i) => ({
fullName: value,
label: value,
default: fieldValues.firstAsDefault.value && i === 0,
})) || [],
},
};
}
Expand Down

0 comments on commit 30bfd8c

Please sign in to comment.