✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.
fix: fetch url
AykutSaracd97734944d96
diff --git a/src/pages/editor.tsx b/src/pages/editor.tsxindex 7e97eedf..dd525f51 100644--- a/src/pages/editor.tsx+++ b/src/pages/editor.tsx@@ -33,7 +33,7 @@ const EditorPage: React.FC = () => {const loading = useJson(state => state.loading);React.useEffect(() => {- if (isReady) checkEditorSession({ url: query?.url, json: query?.json });+ if (isReady) checkEditorSession(query?.json);}, [checkEditorSession, isReady, query]);if (loading) return <Loading message="Fetching JSON from cloud..." />;diff --git a/src/store/useFile.ts b/src/store/useFile.tsindex 9f2bc6a0..d5b201af 100644--- a/src/store/useFile.ts+++ b/src/store/useFile.ts@@ -36,7 +36,7 @@ interface JsonActions {clear: () => void;setFile: (fileData: File) => void;setJsonSchema: (jsonSchema: object | null) => void;- checkEditorSession: ({ url, json }: { url: Query; json: Query }) => void;+ checkEditorSession: (url: Query) => void;}export type File = {@@ -155,9 +155,11 @@ const useFile = create<FileStates & JsonActions>()((set, get) => ({toast.error("Failed to fetch document from URL!");}},- checkEditorSession: ({ url, json }) => {- if (typeof url === "string" && isURL(url)) return get().fetchUrl(url);- if (typeof json === "string") return get().fetchFile(json);+ checkEditorSession: url => {+ if (url && typeof url === "string") {+ if (isURL(url)) return get().fetchUrl(url);+ return get().fetchFile(url);+ }const sessionContent = sessionStorage.getItem("content") as string | null;const format = sessionStorage.getItem("format") as FileFormat | null;