mirror of
https://github.com/chartdb/chartdb.git
synced 2025-11-01 04:23:57 +00:00
fix: update relationship lines when table width changes via expand/shrink button
This commit is contained in:
committed by
Guy Ben-Aharon
parent
a5f8e56b3c
commit
cfcd30269f
@@ -294,6 +294,7 @@ export const Canvas: React.FC<CanvasProps> = ({ initialTables }) => {
|
|||||||
setEdges,
|
setEdges,
|
||||||
showDependenciesOnCanvas,
|
showDependenciesOnCanvas,
|
||||||
databaseType,
|
databaseType,
|
||||||
|
tables, // Add tables to force edge recreation when table properties change
|
||||||
]);
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -997,6 +998,19 @@ export const Canvas: React.FC<CanvasProps> = ({ initialTables }) => {
|
|||||||
width: event.data.table.width,
|
width: event.data.table.width,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Trigger a dimension change to force React Flow to update the node
|
||||||
|
onNodesChangeHandler([
|
||||||
|
{
|
||||||
|
id: event.data.id,
|
||||||
|
type: 'dimensions',
|
||||||
|
dimensions: {
|
||||||
|
width: event.data.table.width,
|
||||||
|
height: node.measured?.height || 0,
|
||||||
|
},
|
||||||
|
resizing: true, // Set resizing flag to ensure the change is processed
|
||||||
|
} as NodeDimensionChange,
|
||||||
|
]);
|
||||||
|
|
||||||
newOverlappingGraph = findTableOverlapping(
|
newOverlappingGraph = findTableOverlapping(
|
||||||
{
|
{
|
||||||
node: {
|
node: {
|
||||||
@@ -1051,7 +1065,14 @@ export const Canvas: React.FC<CanvasProps> = ({ initialTables }) => {
|
|||||||
setOverlapGraph(overlappingTablesInDiagram);
|
setOverlapGraph(overlappingTablesInDiagram);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[overlapGraph, setOverlapGraph, getNode, nodes, filteredSchemas]
|
[
|
||||||
|
overlapGraph,
|
||||||
|
setOverlapGraph,
|
||||||
|
getNode,
|
||||||
|
nodes,
|
||||||
|
filteredSchemas,
|
||||||
|
onNodesChangeHandler,
|
||||||
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
events.useSubscription(eventConsumer);
|
events.useSubscription(eventConsumer);
|
||||||
|
|||||||
Reference in New Issue
Block a user