Free, simple, and intuitive online database diagram editor and SQL generator.
JavaScript databasedatabase-designdatabase-diagramdatabase-schemadbmldiagram-editoreditorer-diagramerderdiagramindexeddbmariadbmcporacle-databaseoracle-dbpostgresqlschema-designsqlsql-serversqlite
Fix loading the diagram on open to load in types and enums
1ilitc84990ca6d9b
diff --git a/src/components/EditorHeader/Modal/Modal.jsx b/src/components/EditorHeader/Modal/Modal.jsxindex 5c86a932..60a2782a 100644--- a/src/components/EditorHeader/Modal/Modal.jsx+++ b/src/components/EditorHeader/Modal/Modal.jsx@@ -17,6 +17,7 @@ import {useTransform,useTypes,useUndoRedo,+ useTasks,} from "../../../hooks";import { saveAs } from "file-saver";import { Parser } from "node-sql-parser";@@ -61,6 +62,7 @@ export default function Modal({const { setTypes } = useTypes();const { settings } = useSettings();const { setEnums } = useEnums();+ const { setTasks } = useTasks();const { setTransform } = useTransform();const { setUndoStack, setRedoStack } = useUndoRedo();const [importSource, setImportSource] = useState({@@ -99,23 +101,31 @@ export default function Modal({setDiagramId(diagram.id);setTitle(diagram.name);setTables(diagram.tables);- setTypes(diagram.types);setRelationships(diagram.references);setAreas(diagram.areas);setNotes(diagram.notes);+ setTasks(diagram.todos ?? []);setTransform({pan: diagram.pan,zoom: diagram.zoom,});setUndoStack([]);setRedoStack([]);+ if (databases[database].hasTypes) {+ setTypes(diagram.types ?? []);+ }+ if (databases[database].hasEnums) {+ setEnums(diagram.enums ?? []);+ }window.name = `d ${diagram.id}`;} else {- Toast.error("Oops! Something went wrong.");+ window.name = "";+ Toast.error(t("didnt_find_diagram"));}})- .catch(() => {- Toast.error("Oops! Couldn't load diagram.");+ .catch((error) => {+ console.log(error);+ Toast.error(t("didnt_find_diagram"));});};diff --git a/src/i18n/locales/en.js b/src/i18n/locales/en.jsindex 11acde0e..813f5a1b 100644--- a/src/i18n/locales/en.js+++ b/src/i18n/locales/en.js@@ -227,6 +227,7 @@ const en = {no_enums_text: "Define enums here",declare_array: "Declare array",empty_index_name: "Declared an index with no name in table '{{tableName}}'",+ didnt_find_diagram: "Oops! Didn't find the diagram.",},};