🔨 refactor(EditNodeModal/index.tsx): add closePopUp function to close the pop-up when the modal is closed
🔨 refactor(EditNodeModal/index.tsx): refactor setOpen function to close the pop-up when the modal is closed
This commit is contained in:
parent
14d80b8f13
commit
290ef87247
1 changed files with 5 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ import { typesContext } from "../../contexts/typesContext";
|
||||||
import { NodeDataType } from "../../types/flow";
|
import { NodeDataType } from "../../types/flow";
|
||||||
import { classNames, limitScrollFieldsModal } from "../../utils";
|
import { classNames, limitScrollFieldsModal } from "../../utils";
|
||||||
import BaseModal from "../baseModal";
|
import BaseModal from "../baseModal";
|
||||||
|
import { PopUpContext } from "../../contexts/popUpContext";
|
||||||
|
|
||||||
const EditNodeModal = forwardRef(
|
const EditNodeModal = forwardRef(
|
||||||
(
|
(
|
||||||
|
|
@ -44,6 +45,7 @@ const EditNodeModal = forwardRef(
|
||||||
const { types } = useContext(typesContext);
|
const { types } = useContext(typesContext);
|
||||||
const { setTabsState, tabId } = useContext(TabsContext);
|
const { setTabsState, tabId } = useContext(TabsContext);
|
||||||
const { reactFlowInstance } = useContext(typesContext);
|
const { reactFlowInstance } = useContext(typesContext);
|
||||||
|
const { closePopUp } = useContext(PopUpContext);
|
||||||
|
|
||||||
let disabled =
|
let disabled =
|
||||||
reactFlowInstance?.getEdges().some((e) => e.targetHandle === data.id) ??
|
reactFlowInstance?.getEdges().some((e) => e.targetHandle === data.id) ??
|
||||||
|
|
@ -74,6 +76,9 @@ const EditNodeModal = forwardRef(
|
||||||
};
|
};
|
||||||
|
|
||||||
const setOpen = (x: boolean) => {
|
const setOpen = (x: boolean) => {
|
||||||
|
if(!x) {
|
||||||
|
closePopUp();
|
||||||
|
}
|
||||||
if (nodeLength > 0) setModalOpen(x);
|
if (nodeLength > 0) setModalOpen(x);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue