Skip to content

Commit

Permalink
hotfix(condo): safe data formatting (#3760)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alllex202 authored Aug 24, 2023
1 parent c9cc639 commit 972a5db
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ export const BaseIncidentForm: React.FC<BaseIncidentFormProps> = (props) => {
const initialIncidentProperties = useMemo(() => get(initialValues, 'incidentProperties', []), [initialValues]) as IIncidentProperty[]
const initialIncidentClassifiers = useMemo(() => get(initialValues, 'incidentClassifiers', []), [initialValues]) as IIncidentClassifierIncident[]

const initialPropertyIds = useMemo(() => initialIncidentProperties.map(item => item.property.id), [initialIncidentProperties])
const initialClassifierIds = useMemo(() => initialIncidentClassifiers.map(item => item.classifier.id), [initialIncidentClassifiers])
const initialPropertyIds = useMemo(() => initialIncidentProperties.map(item => get(item, 'property.id')), [initialIncidentProperties])
const initialClassifierIds = useMemo(() => initialIncidentClassifiers.map(item => get(item, 'classifier.id')), [initialIncidentClassifiers])

const handleFormSubmit = useCallback(async (values) => {
const { properties, allClassifiers, categoryClassifiers, problemClassifiers, ...incidentValues } = values
Expand Down Expand Up @@ -367,7 +367,7 @@ export const BaseIncidentForm: React.FC<BaseIncidentFormProps> = (props) => {
.filter(classifier => !get(classifier, 'problem.id') &&
selectedCategoryWithoutSelectedProblemIds.includes(get(classifier, 'category.id')))
const selectedClassifierIds = [...selectedClassifiersByCategoryAndProblem, ...selectedClassifiersWithoutProblem]
.map(classifier => classifier.id)
.map(classifier => get(classifier, 'id'))

const addedClassifierIds = difference(selectedClassifierIds, initialClassifierIds)
for (const classifierId of addedClassifierIds) {
Expand Down

0 comments on commit 972a5db

Please sign in to comment.