refactor: Remove console.log statements from ParameterComponent and fix clean edges
This commit is contained in:
parent
8b4d5ec21a
commit
12b3a9b717
2 changed files with 23 additions and 19 deletions
|
|
@ -62,8 +62,6 @@ export default function ParameterComponent({
|
||||||
index,
|
index,
|
||||||
outputName,
|
outputName,
|
||||||
}: ParameterComponentType): JSX.Element {
|
}: ParameterComponentType): JSX.Element {
|
||||||
console.log("title", title);
|
|
||||||
console.log("data", data);
|
|
||||||
const infoHtml = useRef<HTMLDivElement & ReactNode>(null);
|
const infoHtml = useRef<HTMLDivElement & ReactNode>(null);
|
||||||
const nodes = useFlowStore((state) => state.nodes);
|
const nodes = useFlowStore((state) => state.nodes);
|
||||||
const edges = useFlowStore((state) => state.edges);
|
const edges = useFlowStore((state) => state.edges);
|
||||||
|
|
@ -82,7 +80,7 @@ export default function ParameterComponent({
|
||||||
debouncedHandleUpdateValues,
|
debouncedHandleUpdateValues,
|
||||||
setNode,
|
setNode,
|
||||||
isLoading,
|
isLoading,
|
||||||
setIsLoading
|
setIsLoading,
|
||||||
);
|
);
|
||||||
|
|
||||||
const { handleNodeClass: handleNodeClassHook } = useHandleNodeClass(
|
const { handleNodeClass: handleNodeClassHook } = useHandleNodeClass(
|
||||||
|
|
@ -90,7 +88,7 @@ export default function ParameterComponent({
|
||||||
name,
|
name,
|
||||||
takeSnapshot,
|
takeSnapshot,
|
||||||
setNode,
|
setNode,
|
||||||
updateNodeInternals
|
updateNodeInternals,
|
||||||
);
|
);
|
||||||
|
|
||||||
const { handleRefreshButtonPress: handleRefreshButtonPressHook } =
|
const { handleRefreshButtonPress: handleRefreshButtonPressHook } =
|
||||||
|
|
@ -99,7 +97,7 @@ export default function ParameterComponent({
|
||||||
let disabled =
|
let disabled =
|
||||||
edges.some(
|
edges.some(
|
||||||
(edge) =>
|
(edge) =>
|
||||||
edge.targetHandle === scapedJSONStringfy(proxy ? { ...id, proxy } : id)
|
edge.targetHandle === scapedJSONStringfy(proxy ? { ...id, proxy } : id),
|
||||||
) ?? false;
|
) ?? false;
|
||||||
|
|
||||||
const handleRefreshButtonPress = async (name, data) => {
|
const handleRefreshButtonPress = async (name, data) => {
|
||||||
|
|
@ -110,7 +108,7 @@ export default function ParameterComponent({
|
||||||
|
|
||||||
const handleOnNewValue = async (
|
const handleOnNewValue = async (
|
||||||
newValue: string | string[] | boolean | Object[],
|
newValue: string | string[] | boolean | Object[],
|
||||||
skipSnapshot: boolean | undefined = false
|
skipSnapshot: boolean | undefined = false,
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
handleOnNewValueHook(newValue, skipSnapshot);
|
handleOnNewValueHook(newValue, skipSnapshot);
|
||||||
};
|
};
|
||||||
|
|
@ -192,14 +190,14 @@ export default function ParameterComponent({
|
||||||
className={classNames(
|
className={classNames(
|
||||||
left ? "my-12 -ml-0.5 " : " my-12 -mr-0.5 ",
|
left ? "my-12 -ml-0.5 " : " my-12 -mr-0.5 ",
|
||||||
"h-3 w-3 rounded-full border-2 bg-background",
|
"h-3 w-3 rounded-full border-2 bg-background",
|
||||||
!showNode ? "mt-0" : ""
|
!showNode ? "mt-0" : "",
|
||||||
)}
|
)}
|
||||||
style={{
|
style={{
|
||||||
borderColor: color ?? nodeColors.unknown,
|
borderColor: color ?? nodeColors.unknown,
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setFilterEdge(
|
setFilterEdge(
|
||||||
groupByFamily(myData, tooltipTitle!, left, nodes!)
|
groupByFamily(myData, tooltipTitle!, left, nodes!),
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
></Handle>
|
></Handle>
|
||||||
|
|
@ -284,12 +282,12 @@ export default function ParameterComponent({
|
||||||
}
|
}
|
||||||
className={classNames(
|
className={classNames(
|
||||||
left ? "-ml-0.5" : "-mr-0.5",
|
left ? "-ml-0.5" : "-mr-0.5",
|
||||||
"h-3 w-3 rounded-full border-2 bg-background"
|
"h-3 w-3 rounded-full border-2 bg-background",
|
||||||
)}
|
)}
|
||||||
style={{ borderColor: color ?? nodeColors.unknown }}
|
style={{ borderColor: color ?? nodeColors.unknown }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setFilterEdge(
|
setFilterEdge(
|
||||||
groupByFamily(myData, tooltipTitle!, left, nodes!)
|
groupByFamily(myData, tooltipTitle!, left, nodes!),
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -79,17 +79,23 @@ export function cleanEdges(nodes: NodeType[], edges: Edge[]) {
|
||||||
const output = sourceNode.data.node!.outputs?.find(
|
const output = sourceNode.data.node!.outputs?.find(
|
||||||
(output) => output.name === name,
|
(output) => output.name === name,
|
||||||
);
|
);
|
||||||
const outputTypes = [output?.selected ?? ""];
|
if (output) {
|
||||||
|
const outputTypes =
|
||||||
|
output!.types.length === 1 ? output!.types : [output!.selected!];
|
||||||
|
|
||||||
const id: sourceHandleType = {
|
const id: sourceHandleType = {
|
||||||
id: sourceNode.data.id,
|
id: sourceNode.data.id,
|
||||||
name: name,
|
name: name,
|
||||||
output_types: outputTypes,
|
output_types: outputTypes,
|
||||||
dataType: sourceNode.data.type,
|
dataType: sourceNode.data.type,
|
||||||
};
|
};
|
||||||
|
console.log("id", id);
|
||||||
|
console.log("sourceHandle", scapeJSONParse(sourceHandle));
|
||||||
if (scapedJSONStringfy(id) !== sourceHandle) {
|
if (scapedJSONStringfy(id) !== sourceHandle) {
|
||||||
newEdges = newEdges.filter((e) => e.id !== edge.id);
|
newEdges = newEdges.filter((e) => e.id !== edge.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return newEdges;
|
return newEdges;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue