diff --git a/src/utils/graph.ts b/src/utils/graph.ts index 07a4ffdb..c9696b74 100644 --- a/src/utils/graph.ts +++ b/src/utils/graph.ts @@ -178,10 +178,10 @@ export const getConnectedEdges = (nodes: Node[], edges: Edge[]): Edge[] => { }); }; -export const fitView = ({ padding }: FitViewParams = { padding: 0 }): void => { +export const fitView = ({ padding }: FitViewParams = { padding: 0.1 }): void => { const { nodes, width, height, d3Selection, d3Zoom } = store.getState(); - if (!d3Selection || !d3Zoom) { + if (!d3Selection || !d3Zoom || !nodes.length) { return; }