feat: Migrate base classes to outputs in FrontendNode

This commit migrates the base classes of the FrontendNode to the outputs field. Each base class is converted into an OutputField with the same name and type. This change ensures consistency and improves the structure of the code.
This commit is contained in:
ogabrielluiz 2024-05-30 17:17:36 -03:00
commit 25752b1aa8
2 changed files with 19 additions and 4 deletions

View file

@ -444,9 +444,13 @@ export function updateNewOutput({ nodes, edges }: updateEdgesHandleIdsType) {
!sourceNode.data.node?.outputs ||
sourceNode.data.node!.outputs!.length === 0
) {
sourceNode.data.node!.outputs = [
{ types: sourceNode.data.node!.base_classes, selected: selected },
];
const outputTypes = sourceNode.data.node!.output_types;
// create a new output field for each output type
sourceNode.data.node!.outputs = outputTypes?.map((type) => ({
types: [type],
selected: selected,
name: type,
}));
}
}
edge.sourceHandle = scapedJSONStringfy(newSourceHandle);