Skip to content

Commit 9597dbe

Browse files
committed
temp bug fix for group info being overwritten when loading a flow from storage
1 parent 86847fd commit 9597dbe

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

libs/visual-programming-system/src/components/rect.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,10 @@ export class Rect<T extends BaseNodeInfo> {
15671567
}
15681568
if (this.nodeInfo?.isGroup) {
15691569
const groupOfInitiator = initiator?.nodeInfo?.groupId;
1570-
if (groupOfInitiator && groupOfInitiator !== this.nodeComponent.id) {
1570+
if (
1571+
!groupOfInitiator ||
1572+
(groupOfInitiator && groupOfInitiator !== this.nodeComponent.id)
1573+
) {
15711574
this.nodeInfo?.groupedNodeIds?.forEach((id) => {
15721575
const groupedNode = this.canvasApp?.elements.get(id);
15731576
if (groupedNode && groupedNode.id !== initiator.id) {

libs/visual-programming-system/src/import/import-to-canvas.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export const importToCanvas = <T extends BaseNodeInfo>(
245245
});
246246
}
247247
} else {
248-
nodeTask.createVisualNode(
248+
const createdNode = nodeTask.createVisualNode(
249249
canvasApp,
250250
node.x,
251251
node.y,
@@ -258,6 +258,19 @@ export const importToCanvas = <T extends BaseNodeInfo>(
258258
node.nodeInfo,
259259
getNodeTaskFactory
260260
);
261+
262+
// TODO : find a better implementation for this
263+
// problem now is that the nodes should pass the above node.nodeInfo themselves
264+
// to the create canvasApp.createRect function call when creating the node ...
265+
// ... and then it is overwritten.. the below fixes this for now
266+
if (
267+
createdNode &&
268+
node.nodeInfo?.isInGroup &&
269+
createdNode.nodeInfo
270+
) {
271+
createdNode.nodeInfo.isInGroup = true;
272+
createdNode.nodeInfo.groupId = node.nodeInfo.groupId;
273+
}
261274
}
262275
}
263276
}

libs/web-flow-executor/src/nodes/group.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const getGroup: NodeTaskFactory<NodeInfo> = (
4949
const wrapper = createElement(
5050
'div',
5151
{
52-
class: `${cssClasses.wrapperGroupCssClasses} bg-purple-500`,
52+
class: `${cssClasses.wrapperGroupCssClasses} bg-slate-700`,
5353
},
5454
undefined
5555
) as unknown as INodeComponent<NodeInfo>;

0 commit comments

Comments
 (0)