Skip to content

Commit

Permalink
chore: Fix mobx warnings in TaskNode
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-phillips-18 committed Jul 5, 2023
1 parent 4f63dc2 commit 4bd99ea
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/module/src/pipelines/components/nodes/TaskNode.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import { action } from 'mobx';
import { TooltipProps } from '@patternfly/react-core';
import { css } from '@patternfly/react-styles';
import styles from '../../../css/topology-pipelines';
Expand Down Expand Up @@ -284,11 +285,13 @@ const TaskNodeInner: React.FC<TaskNodeInnerProps> = observer(({
]);

React.useEffect(() => {
const sourceEdges = element.getSourceEdges();
sourceEdges.forEach(edge => {
const data = edge.getData();
edge.setData({ ...(data || {}), indent: detailsLevel === ScaleDetailsLevel.high ? width - pillWidth : 0 });
});
action(() => {
const sourceEdges = element.getSourceEdges();
sourceEdges.forEach(edge => {
const data = edge.getData();
edge.setData({ ...(data || {}), indent: detailsLevel === ScaleDetailsLevel.high ? width - pillWidth : 0 });
});
})();
}, [detailsLevel, element, pillWidth, width]);

const scale = element.getGraph().getScale();
Expand Down

0 comments on commit 4bd99ea

Please sign in to comment.