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 committed Mar 8, 2024
1 parent 2710f7b commit e607454
Showing 1 changed file with 10 additions and 3 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 ?? [],
);
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 e607454

Please sign in to comment.