Skip to content

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

fix: empty node size

AykutSaracf3d8764ac1d2
diff --git a/src/components/CustomNode/index.tsx b/src/components/CustomNode/index.tsx
index 3e7dfbf7..82abee6d 100644
--- a/src/components/CustomNode/index.tsx
+++ b/src/components/CustomNode/index.tsx
@@ -11,8 +11,6 @@ export interface CustomNodeProps {
}
const rootProps = {
- width: 40,
- height: 40,
rx: 50,
ry: 50,
};
diff --git a/src/utils/core/calculateNodeSize.ts b/src/utils/core/calculateNodeSize.ts
index e67004cc..cb39c3f3 100644
--- a/src/utils/core/calculateNodeSize.ts
+++ b/src/utils/core/calculateNodeSize.ts
@@ -18,6 +18,8 @@ export const isContentImage = (value: string | [string, string][]) => {
const sizeCache = new Map<string | [string, string][], { width: number; height: number }>();
function calculateWidthAndHeight(str: string, single = false) {
+ if (!str) return { width: 45, height: 45 };
+
const dummyElement = document.createElement("div");
dummyElement.style.whiteSpace = single ? "nowrap" : "pre-wrap";
dummyElement.innerHTML = str;