Skip to content

Commit

Permalink
fix(Flow): duplicate node id
Browse files Browse the repository at this point in the history
  • Loading branch information
MEsteves22 authored and zettca committed Nov 15, 2023
1 parent 1464c1e commit 414f799
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/lab/src/components/Flow/Node/BaseNode.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { isValidElement, useCallback, useEffect, useState } from "react";

import {
Edge,
Handle,
Expand All @@ -9,7 +8,7 @@ import {
useReactFlow,
useStore,
} from "reactflow";

import { uid } from "uid";
import {
ExtractNames,
HvActionGeneric,
Expand All @@ -25,7 +24,7 @@ import {
HvFlowBuiltInActions,
HvFlowNodeInput,
HvFlowNodeOutput,
} from "../types/index";
} from "../types";
import { useNodeMetaRegistry } from "../FlowContext/NodeMetaContext";
import { staticClasses, useClasses } from "./BaseNode.styles";

Expand Down Expand Up @@ -129,7 +128,7 @@ export const HvFlowBaseNode = ({
reactFlowInstance.addNodes([
{
...node,
id: `${reactFlowInstance.getNodes().length + 1}`,
id: uid(),
position: {
x: node.position.x,
y: node.position.y + (node.height || 0) + 20,
Expand Down

0 comments on commit 414f799

Please sign in to comment.