Skip to content

Commit

Permalink
fix(Canvas): DnD related logs
Browse files Browse the repository at this point in the history
  • Loading branch information
lordrip committed Jan 17, 2025
1 parent 8c32011 commit cdb4548
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 10 additions & 2 deletions packages/ui/src/components/Visualization/Canvas/Canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,16 @@ export const Canvas: FunctionComponent<PropsWithChildren<CanvasProps>> = ({ enti
},
};

controller.fromModel(model, false);
setInitialized(true);
if (!initialized) {
controller.fromModel(model, false);
setInitialized(true);
return;
}

requestAnimationFrame(() => {
controller.fromModel(model, true);
controller.getGraph().layout();

Check warning on line 101 in packages/ui/src/components/Visualization/Canvas/Canvas.tsx

View check run for this annotation

Codecov / codecov/patch

packages/ui/src/components/Visualization/Canvas/Canvas.tsx#L99-L101

Added lines #L99 - L101 were not covered by tests
});
}, [controller, entities, visibleFlows]);

const handleSelection = useCallback((selectedIds: string[]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ const CustomNodeInner: FunctionComponent<CustomNodeProps> = observer(
nodes: [],
edges: [],
});
entitiesContext.updateEntitiesFromCamelResource();

requestAnimationFrame(() => {
entitiesContext.updateEntitiesFromCamelResource();

Check warning on line 119 in packages/ui/src/components/Visualization/Custom/Node/CustomNode.tsx

View check run for this annotation

Codecov / codecov/patch

packages/ui/src/components/Visualization/Custom/Node/CustomNode.tsx#L118-L119

Added lines #L118 - L119 were not covered by tests
});
} else {
// Show all edges after dropping
element

Check warning on line 123 in packages/ui/src/components/Visualization/Custom/Node/CustomNode.tsx

View check run for this annotation

Codecov / codecov/patch

packages/ui/src/components/Visualization/Custom/Node/CustomNode.tsx#L123

Added line #L123 was not covered by tests
Expand Down

0 comments on commit cdb4548

Please sign in to comment.