Database diagrams editor that allows you to visualize and design your DB with a single query.
TypeScript databasedbdb-migrationeditorerdmariadbmssqlmysqlpostgresqlreactreact-flowschema-migrationssqlsqlitetypescriptvisualizationxyflow
add title to page
Guy Ben-Aharondcaef36d162a
diff --git a/src/context/chartdb-context/chartdb-provider.tsx b/src/context/chartdb-context/chartdb-provider.tsxindex c6916301..3dc14aa0 100644--- a/src/context/chartdb-context/chartdb-provider.tsx+++ b/src/context/chartdb-context/chartdb-provider.tsx@@ -1,4 +1,4 @@-import React, { useCallback, useMemo, useState } from 'react';+import React, { useCallback, useEffect, useMemo, useState } from 'react';import { DBTable } from '@/lib/domain/db-table';import { deepCopy, generateId } from '@/lib/utils';import { randomColor } from '@/lib/colors';@@ -41,6 +41,14 @@ export const ChartDBProvider: React.FC<React.PropsWithChildren> = ({const defaultSchemaName = defaultSchemas[databaseType];+ useEffect(() => {+ if (diagramName) {+ document.title = `ChartDB - ${diagramName}`;+ } else {+ document.title = 'ChartDB';+ }+ }, [diagramName]);+const schemas = useMemo(() =>databaseType === DatabaseType.POSTGRESQL ||diff --git a/src/pages/editor-page/editor-page.tsx b/src/pages/editor-page/editor-page.tsxindex c27e3e14..bf502f07 100644--- a/src/pages/editor-page/editor-page.tsx+++ b/src/pages/editor-page/editor-page.tsx@@ -60,7 +60,6 @@ export const EditorPage: React.FC = () => {navigate('/');}setInitialDiagram(diagram);- document.title = `ChartDB - ${diagram!.name}`;hideLoader();} else if (!diagramId && config.defaultDiagramId) {const diagram = await loadDiagram(config.defaultDiagramId);@@ -91,14 +90,6 @@ export const EditorPage: React.FC = () => {updateConfig,]);- useEffect(() => {- if (currentDiagram?.name) {- document.title = `ChartDB - ${currentDiagram.name}`;- } else {- document.title = 'ChartDB';- }- }, [currentDiagram?.name]);-return (<><sectiondiff --git a/src/pages/editor-page/top-navbar/top-navbar.tsx b/src/pages/editor-page/top-navbar/top-navbar.tsxindex cb959641..632281f1 100644--- a/src/pages/editor-page/top-navbar/top-navbar.tsx+++ b/src/pages/editor-page/top-navbar/top-navbar.tsx@@ -91,7 +91,6 @@ export const TopNavbar: React.FC<TopNavbarProps> = () => {if (!editMode) return;if (editedDiagramName.trim()) {updateDiagramName(editedDiagramName.trim());- document.title = `ChartDB - ${editedDiagramName.trim()}`;}setEditMode(false);}, [editedDiagramName, updateDiagramName, editMode]);