Fixed flow not creating after creating custom component

This commit is contained in:
Lucas Oliveira 2023-07-25 10:01:21 -03:00
commit 59ef06ab79

View file

@ -52,7 +52,7 @@ export default function ParameterComponent({
const [position, setPosition] = useState(0); const [position, setPosition] = useState(0);
const { setTabsState, tabId, save, flows } = useContext(TabsContext); const { setTabsState, tabId, save, flows } = useContext(TabsContext);
const flow = flows.find((f) => f.id === tabId).data.nodes; const flow = flows.find((f) => f.id === tabId).data?.nodes ?? null;
// Update component position // Update component position
useEffect(() => { useEffect(() => {
@ -106,7 +106,7 @@ export default function ParameterComponent({
function renderTooltips() { function renderTooltips() {
let groupedObj = groupByFamily(myData, tooltipTitle, left, data.type, flow); let groupedObj = groupByFamily(myData, tooltipTitle, left, data.type, flow);
if (groupedObj?.length === 0) { if (groupedObj?.length === 0 && flow && flow.length > 0) {
groupedObj = groupByFamilyCustom( groupedObj = groupByFamilyCustom(
myData, myData,
tooltipTitle, tooltipTitle,
@ -171,7 +171,7 @@ export default function ParameterComponent({
useEffect(() => { useEffect(() => {
renderTooltips(); renderTooltips();
}, [tooltipTitle, flow.length]); }, [tooltipTitle, flow]);
return ( return (
<div <div
ref={ref} ref={ref}