Skip to content

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

refactor

AykutSarac5a02cb8809d7
diff --git a/src/features/editor/views/TreeView/index.tsx b/src/features/editor/views/TreeView/index.tsx
index 486d7f78..470e47f3 100644
--- a/src/features/editor/views/TreeView/index.tsx
+++ b/src/features/editor/views/TreeView/index.tsx
@@ -10,22 +10,20 @@ export const TreeView = () => {
const json = useJson(state => state.json);
return (
- <>
- <JSONTree
- hideRoot
- data={JSON.parse(json)}
- valueRenderer={(valueAsString, value) => <Value {...{ valueAsString, value }} />}
- labelRenderer={(keyPath, nodeType) => <Label {...{ keyPath, nodeType }} />}
- theme={{
- extend: {
- overflow: "scroll",
- height: "100%",
- scheme: "monokai",
- author: "wimer hazenberg (http://www.monokai.nl)",
- base00: theme.GRID_BG_COLOR,
- },
- }}
- />
- </>
+ <JSONTree
+ hideRoot
+ data={JSON.parse(json)}
+ valueRenderer={(valueAsString, value) => <Value {...{ valueAsString, value }} />}
+ labelRenderer={(keyPath, nodeType) => <Label {...{ keyPath, nodeType }} />}
+ theme={{
+ extend: {
+ overflow: "scroll",
+ height: "100%",
+ scheme: "monokai",
+ author: "wimer hazenberg (http://www.monokai.nl)",
+ base00: theme.GRID_BG_COLOR,
+ },
+ }}
+ />
);
};
diff --git a/src/store/useFile.ts b/src/store/useFile.ts
index e4f99d0f..188a1249 100644
--- a/src/store/useFile.ts
+++ b/src/store/useFile.ts
@@ -178,8 +178,8 @@ const useFile = create<FileStates & JsonActions>()((set, get) => ({
}
},
checkEditorSession: (url, widget) => {
- if (url && typeof url === "string") {
- if (isURL(url)) return get().fetchUrl(url);
+ if (url && typeof url === "string" && isURL(url)) {
+ return get().fetchUrl(url);
}
let contents = defaultJson;