Skip to content

Commit

Permalink
Fix error handling cutsets when there is only one cutset
Browse files Browse the repository at this point in the history
  • Loading branch information
kostobog committed Jun 11, 2024
1 parent 0f06460 commit 52c35bf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/editor/faultTree/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { JOINTJS_NODE_MODEL } from "@components/editor/faultTree/shapes/constant
import { calculateCutSets } from "@services/faultTreeService";
import { FaultEventScenario } from "@models/faultEventScenario";
import { useAppBar } from "../../../contexts/AppBarContext";
import { asArray } from "@utils/utils";

const Editor = () => {
const history = useNavigate();
Expand Down Expand Up @@ -58,7 +59,7 @@ const Editor = () => {
setRootEvent(updatedRootEvent);

if (faultTree.faultEventScenarios) {
setFaultEventScenarios([getScenarioWithHighestProbability(faultTree.faultEventScenarios)]);
setFaultEventScenarios([getScenarioWithHighestProbability(asArray(faultTree.faultEventScenarios))]);
}

if (contextMenuSelectedEvent) {
Expand Down Expand Up @@ -256,7 +257,7 @@ const Editor = () => {
setHighlightedElement={setHighlightedElementView}
refreshTree={refreshTree}
faultEventScenarios={faultEventScenarios}
possibleFaultEventScenarios={faultTree?.faultEventScenarios ? faultTree?.faultEventScenarios : []}
possibleFaultEventScenarios={asArray(faultTree?.faultEventScenarios)}
showPath={showPath}
showTable={showTable}
onScenarioSelect={(scenario: FaultEventScenario) => handleOnScenarioSelect(scenario)}
Expand Down

0 comments on commit 52c35bf

Please sign in to comment.