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: fetch id & url

AykutSarac6c072b8b2b2b
diff --git a/src/store/useFile.ts b/src/store/useFile.ts
index 648a5df8..8d8a0992 100644
--- a/src/store/useFile.ts
+++ b/src/store/useFile.ts
@@ -90,7 +90,7 @@ const useFile = create<FileStates & JsonActions>()((set, get) => ({
if (useUser.getState().premium) set({ jsonSchema });
},
setFile: fileData => {
- set({ fileData, format: fileData.format });
+ set({ fileData, format: fileData.format || FileFormat.JSON });
get().setContents({ contents: fileData.json, hasChanges: false });
},
getContents: () => get().contents,
@@ -152,7 +152,7 @@ const useFile = create<FileStates & JsonActions>()((set, get) => ({
const json = await res.json();
const jsonStr = JSON.stringify(json, null, 2);
- useGraph.getState().setGraph(jsonStr);
+ get().setContents({ contents: jsonStr });
return useJson.setState({ json: jsonStr, loading: false });
} catch (error) {
get().clear();