Skip to content

Database diagrams editor that allows you to visualize and design your DB with a single query.

fix: solve issue with multiple render of tables (#823)

Guy Ben-Aharon0c7eaa2df20c
diff --git a/src/pages/editor-page/canvas/canvas.tsx b/src/pages/editor-page/canvas/canvas.tsx
index fba6fc91..a9655da0 100644
--- a/src/pages/editor-page/canvas/canvas.tsx
+++ b/src/pages/editor-page/canvas/canvas.tsx
@@ -464,6 +464,10 @@ export const Canvas: React.FC<CanvasProps> = ({ initialTables }) => {
);
useEffect(() => {
+ if (areas.length == 0) {
+ return;
+ }
+
const checkParentAreas = debounce(() => {
const updatedTables = updateTablesParentAreas(tables, areas);
const needsUpdate: Array<{
@@ -475,6 +479,7 @@ export const Canvas: React.FC<CanvasProps> = ({ initialTables }) => {
const oldTable = tables[index];
if (
oldTable &&
+ (!!newTable.parentAreaId || !!oldTable.parentAreaId) &&
newTable.parentAreaId !== oldTable.parentAreaId
) {
needsUpdate.push({