diff --git a/package.json b/package.json index 56705815..d2952fd9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "json-schema-studio", - "version": "0.5.12-beta", + "version": "0.5.13-beta", "type": "module", "homepage": "studio.ioflux.org", "repository": "https://github.com/ioflux-org/studio-json-schema", @@ -43,4 +43,4 @@ "typescript-eslint": "^7.3.1", "vite": "^6.3.5" } -} +} \ No newline at end of file diff --git a/src/components/GraphView.tsx b/src/components/GraphView.tsx index 0ba8244b..e6394d36 100644 --- a/src/components/GraphView.tsx +++ b/src/components/GraphView.tsx @@ -213,6 +213,13 @@ const GraphView = ({ useEffect(() => { try { + if (!compiledSchema) { + setNodes([]); + setEdges([]); + setSelectedNode(null); + return; + } + const result = generateNodesAndEdges(compiledSchema); if (!result) return; diff --git a/src/components/MonacoEditor.tsx b/src/components/MonacoEditor.tsx index a5584dc2..339080a7 100644 --- a/src/components/MonacoEditor.tsx +++ b/src/components/MonacoEditor.tsx @@ -205,6 +205,10 @@ const MonacoEditor = () => { useEffect(() => { saveFormat(SESSION_FORMAT_KEY, schemaFormat); + if (!schemaText.trim()) { + return; + } + const schemaJSON = loadSchemaJSON(SESSION_SCHEMA_KEY); setSchemaText( @@ -215,7 +219,14 @@ const MonacoEditor = () => { }, [schemaFormat]); useEffect(() => { - if (!schemaText.trim()) return; + if (!schemaText.trim()) { + setCompiledSchema(null); + setSchemaValidation({ + status: "error", + message: VALIDATION_UI["error"].message + "Schema cannot be empty", + }); + return; + } const timeout = setTimeout(async () => { try {