Skip to content

Commit

Permalink
[frontend] Fix cannot add TTP directly from matrix (#6112)
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahBocognano authored Mar 13, 2024
1 parent 9468171 commit 2345b8e
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FunctionComponent, useRef, useState } from 'react';
import React, { FunctionComponent, useEffect, useRef, useState } from 'react';
import { v4 as uuid } from 'uuid';
import { graphql } from 'react-relay';
import * as R from 'ramda';
Expand Down Expand Up @@ -303,15 +303,22 @@ const StixCoreRelationshipCreationFromEntity: FunctionComponent<StixCoreRelation
: emptyFilterGroup;
const classes = useStyles();
const { t_i18n } = useFormatter();
const [open, setOpen] = useState(false);
const [open, setOpen] = useState(targetEntitiesProps.length !== 0);
const [openSpeedDial, setOpenSpeedDial] = useState(false);
const [openCreateEntity, setOpenCreateEntity] = useState(false);
const [openCreateObservable, setOpenCreateObservable] = useState(false);
const [step, setStep] = useState(0);
const [step, setStep] = useState(targetEntitiesProps.length === 0 ? 0 : 1);
const [targetEntities, setTargetEntities] = useState(
targetEntitiesProps ?? [],
targetEntitiesProps,
);
const [selectedElements, setSelectedElements] = useState<Record<string, StixCoreRelationshipCreationFromEntityStixCoreObjectsLine_node$data>>({});
useEffect(() => {
if (targetEntitiesProps !== targetEntities) {
setTargetEntities(targetEntitiesProps);
setStep(targetEntitiesProps.length === 0 ? 0 : 1);
setOpen(targetEntitiesProps.length !== 0);
}
}, [targetEntitiesProps]);
const [sortBy, setSortBy] = useState('_score');
const [orderAsc, setOrderAsc] = useState(false);
const [filters, helpers] = useFiltersState(actualTypeFilters, actualTypeFilters);
Expand Down

0 comments on commit 2345b8e

Please sign in to comment.