Skip to content

Commit 3a230e6

Browse files
fix circular dependency
1 parent 19dca04 commit 3a230e6

6 files changed

Lines changed: 9 additions & 20 deletions

File tree

packages/app-builder/src/components/CaseManager/MainLinksGraph.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import { CustomerGraphProvider } from '@app-builder/components/Graph/contexts/CustomerGraphProvider';
22
import { GraphIndexProvider } from '@app-builder/components/Graph/contexts/GraphIndexContext';
33
import { graphEdgeTypes, graphNodeTypes } from '@app-builder/components/Graph/GraphComponents';
4-
import {
5-
GraphMeasuredLayout,
6-
graphFitViewOptions,
7-
useLaidOutGraph,
8-
} from '@app-builder/components/Graph/lib/use-laid-out-graph';
4+
import { graphFitViewOptions } from '@app-builder/components/Graph/lib/graph-fit-view';
5+
import { GraphMeasuredLayout, useLaidOutGraph } from '@app-builder/components/Graph/lib/use-laid-out-graph';
96
import { type DataModel } from '@app-builder/models/data-model';
107
import { type GraphData } from '@app-builder/models/graph';
118
import { useGetGenerateGraphQuery } from '@app-builder/queries/graph/generate-graph';

packages/app-builder/src/components/Data/SemanticTables/CreateTable/SampleGraph.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { GraphIndexProvider } from '@app-builder/components/Graph/contexts/GraphIndexContext';
22
import { useGraphInteractionActions } from '@app-builder/components/Graph/contexts/GraphInteractionContext';
33
import { graphEdgeTypes, graphNodeTypes } from '@app-builder/components/Graph/GraphComponents';
4+
import { graphFitViewOptions } from '@app-builder/components/Graph/lib/graph-fit-view';
45
import { GraphRfEdge, GraphRfNode } from '@app-builder/components/Graph/lib/graph-rf-types';
56
import { EMPTY_HOVER_TRAIL, shortestPathUnion } from '@app-builder/components/Graph/lib/hover-trail';
6-
import {
7-
GraphMeasuredLayout,
8-
graphFitViewOptions,
9-
useLaidOutGraph,
10-
} from '@app-builder/components/Graph/lib/use-laid-out-graph';
7+
import { GraphMeasuredLayout, useLaidOutGraph } from '@app-builder/components/Graph/lib/use-laid-out-graph';
118
import { DataModel } from '@app-builder/models';
129
import {
1310
type GraphData,

packages/app-builder/src/components/Graph/GraphImpl.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,12 @@ import { useSetGraphStats } from './contexts/GraphStatsContext';
1313
import { useGraphStructure } from './contexts/GraphStructureContext';
1414
import { useGraphViewSettings } from './contexts/GraphViewSettingsContext';
1515
import { graphEdgeTypes, graphNodeTypes } from './GraphComponents';
16+
import { graphFitViewOptions } from './lib/graph-fit-view';
1617
import { graphI18n } from './lib/graph-i18n';
1718
import { type GraphObjectRef, nodeKey, parseNodeKey } from './lib/graph-keys';
1819
import { GraphRfEdge, type GraphRfNode } from './lib/graph-rf-types';
1920
import { EMPTY_HOVER_TRAIL, shortestPathUnion } from './lib/hover-trail';
20-
import {
21-
applyVisibilityFilters,
22-
GraphMeasuredLayout,
23-
graphFitViewOptions,
24-
useLaidOutGraph,
25-
} from './lib/use-laid-out-graph';
21+
import { applyVisibilityFilters, GraphMeasuredLayout, useLaidOutGraph } from './lib/use-laid-out-graph';
2622
import '@xyflow/react/dist/style.css';
2723

2824
export type GraphImplProps = {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const graphFitViewOptions = { maxZoom: 1 } as const;

packages/app-builder/src/components/Graph/lib/use-laid-out-graph.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
77
import { useGraphStructure } from '../contexts/GraphStructureContext';
88
import { useGraphViewSettings } from '../contexts/GraphViewSettingsContext';
99
import { createGraphTypeHelpers } from './data-model-map';
10+
import { graphFitViewOptions } from './graph-fit-view';
1011
import { buildGraphIndex } from './graph-index';
1112
import { clusterGraphElements, layoutGraph, withBestHandles } from './graph-layout';
1213
import { type GraphRfEdge, type GraphRfNode } from './graph-rf-types';
1314
import { toFlatFlowElements } from './utils';
1415

15-
/** Caps auto-fit at native node size so sparse graphs don't fill the pane. */
16-
export const graphFitViewOptions = { maxZoom: 1 } as const;
17-
1816
/** Re-run layout once React Flow has measured node sizes (must be a ReactFlow child). */
1917
export function GraphMeasuredLayout({
2018
layoutElements,

packages/app-builder/src/components/ReactFlow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import '@xyflow/react/dist/style.css';
1313
import { useCallback, useEffect, useRef } from 'react';
1414
import { Icon } from 'ui-icons';
15-
import { graphFitViewOptions } from './Graph/lib/use-laid-out-graph';
15+
import { graphFitViewOptions } from './Graph/lib/graph-fit-view';
1616

1717
type LayoutElements<NodeType extends Node, EdgeType extends Edge> = (
1818
nodes: NodeType[],

0 commit comments

Comments
 (0)