Skip to content

Commit

Permalink
Update flowchart-wrapper.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jitu5 authored Feb 26, 2025
1 parent a5b97e9 commit 2acfd16
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/components/flowchart-wrapper/flowchart-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import { toggleFocusMode } from '../../actions';
import { loadNodeData } from '../../actions/nodes';
import { loadPipelineData } from '../../actions/pipelines';
import { toggleModularPipelinesVisibilityState } from '../../actions/modular-pipelines';
import ExportModal from '../export-modal';
import FlowChart from '../flowchart';
import PipelineWarning from '../pipeline-warning';
Expand Down Expand Up @@ -55,6 +56,7 @@ export const FlowChartWrapper = ({
onToggleFocusMode,
onToggleModularPipelineActive,
onToggleModularPipelineExpanded,
onToggleModularPipelinesVisibilityState,
onToggleNodeSelected,
onUpdateActivePipeline,
pipelines,
Expand All @@ -76,6 +78,7 @@ export const FlowChartWrapper = ({
const [usedNavigationBtn, setUsedNavigationBtn] = useState(false);

const graphRef = useRef(null);
const isFirstRender = useRef(true);

const {
matchedFlowchartMainPage,
Expand Down Expand Up @@ -125,6 +128,16 @@ export const FlowChartWrapper = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [activePipeline, tag, nodeType, expandAllPipelines]);

useEffect(() => {
// Skip the first render to avoid unnecessary call of onToggleModularPipelinesVisibilityState
if (isFirstRender.current) {
isFirstRender.current = false;
return;
}

onToggleModularPipelinesVisibilityState(expandAllPipelines);
}, [expandAllPipelines, onToggleModularPipelinesVisibilityState]);

const resetErrorMessage = () => {
setErrorMessage({});
setIsInvalidUrl(false);
Expand Down Expand Up @@ -352,6 +365,9 @@ export const mapDispatchToProps = (dispatch) => ({
onToggleNodeSelected: (nodeID) => {
dispatch(loadNodeData(nodeID));
},
onToggleModularPipelinesVisibilityState: (isExpanded) => {
dispatch(toggleModularPipelinesVisibilityState(isExpanded));
},
onToggleModularPipelineActive: (modularPipelineIDs, active) => {
dispatch(toggleModularPipelineActive(modularPipelineIDs, active));
},
Expand Down

0 comments on commit 2acfd16

Please sign in to comment.