This commit is contained in:
Gabriel Almeida 2023-05-04 18:31:05 -03:00
commit c630f293b0
2 changed files with 3 additions and 5 deletions

View file

@ -34,7 +34,6 @@ export default function GenericNode({
const { reactFlowInstance } = useContext(typesContext);
const [params, setParams] = useState([]);
console.log();
useEffect(() => {
if (reactFlowInstance) {
@ -53,15 +52,13 @@ export default function GenericNode({
body: JSON.stringify(reactFlowInstance.toObject()),
});
console.log(response.status, response.body);
if (response.status === 200) {
setValidationStatus("success");
} else if (response.status === 500) {
setValidationStatus("error");
}
} catch (error) {
console.error("Error validating node:", error);
// console.error("Error validating node:", error);
setValidationStatus("error");
}
}, 1000), // Adjust the debounce delay (500ms) as needed

View file

@ -158,7 +158,7 @@ export default function FlowPage({ flow }:{flow:FlowType}) {
const onDelete = (mynodes) => {
setEdges(
edges.filter(
(ns) => !nodes.some((n) => ns.source === n.id || ns.target === n.id)
(ns) => !mynodes.some((n) => ns.source === n.id || ns.target === n.id)
)
);
};
@ -208,6 +208,7 @@ export default function FlowPage({ flow }:{flow:FlowType}) {
onDragOver={onDragOver}
onDrop={onDrop}
onNodesDelete={onDelete}
selectNodesOnDrag={false}
>
<Background className="dark:bg-gray-900"/>
<Controls className="[&>button]:text-black [&>button]:dark:bg-gray-800 hover:[&>button]:dark:bg-gray-700 [&>button]:dark:text-gray-400 [&>button]:dark:fill-gray-400 [&>button]:dark:border-gray-600">