fix(fitview): emtpy graph doesnt crash closes #50
This commit is contained in:
+2
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user