chore(tabsContext.tsx): import cloneDeep function from lodash to improve code readability and maintainability

fix(tabsContext.tsx): fix comment typo
fix(tabsContext.tsx): add missing semicolon to improve code consistency
fix(tabsContext.tsx): clone edge data object to prevent mutation of original object
refactor(PageComponent/index.tsx): remove unnecessary comment
This commit is contained in:
anovazzi1 2023-10-25 13:50:43 -03:00
commit a9a1316183
2 changed files with 3 additions and 2 deletions

View file

@ -1,5 +1,5 @@
import { AxiosError } from "axios";
import _ from "lodash";
import _, { cloneDeep } from "lodash";
import {
ReactNode,
createContext,
@ -428,6 +428,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
id: source,
});
sourceHandleObject.id = source;
edge.data.sourceHandle = sourceHandleObject;
const targetHandleObject: targetHandleType = scapeJSONParse(
edge.targetHandle!
@ -452,6 +453,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
sourceHandle,
targetHandle,
id,
data: cloneDeep(edge.data),
style: { stroke: "#555" },
className:
targetHandleObject.type === "Text"

View file

@ -310,7 +310,6 @@ export default function Page({
event.dataTransfer.getData("nodedata")
);
// If data type is not "chatInput" or if there are no "chatInputNode" nodes present in the ReactFlow instance, create a new node
// Calculate the position where the node should be created
const position = reactFlowInstance!.project({
x: event.clientX - reactflowBounds!.left,