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