Skip to content

Commit

Permalink
Fix resetting FaultEventMenu form, properly update the selected value…
Browse files Browse the repository at this point in the history
… in the autocomplete component.
  • Loading branch information
kostobog committed Sep 11, 2024
1 parent 3533204 commit 6185cb9
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,20 @@ const FaultEventShapeToolPane = ({ data, refreshTree, formMethods }: Props) => {

const getFormValues = (data) => {
if (data) {
const safeSupertype = asArray(data.supertypes).map((t) => ({ name: t.name, iri: t.iri, types: t.types }))?.[0];
const supertypes = asArray(data.supertypes);
const safeExistingEvent = (supertypes.length ? supertypes : [data]).map((t) => ({
name: t.name,
iri: t.iri,
types: t.types,
}))?.[0];
return {
eventType: data.eventType,
name: data.name,
description: data.description,
probability: data.probability ? data.probability : 0.01,
gateType: data.gateType ? data.gateType : null,
sequenceProbability: data.sequenceProbability,
existingEvent: safeSupertype,
existingEvent: safeExistingEvent,
};
} else {
return {};
Expand Down

0 comments on commit 6185cb9

Please sign in to comment.