fix: update relationship when table width changes via expand/shrink (#825)

This commit is contained in:
Guy Ben-Aharon
2025-08-03 22:41:11 +03:00
committed by GitHub
parent 2fdad2344c
commit bc52933b58
3 changed files with 34 additions and 10 deletions

18
package-lock.json generated
View File

@@ -35,7 +35,7 @@
"@radix-ui/react-toggle-group": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.8",
"@uidotdev/usehooks": "^2.4.1",
"@xyflow/react": "^12.3.1",
"@xyflow/react": "^12.8.2",
"ahooks": "^3.8.1",
"ai": "^3.3.14",
"class-variance-authority": "^0.7.1",
@@ -4603,12 +4603,12 @@
"license": "MIT"
},
"node_modules/@xyflow/react": {
"version": "12.4.2",
"resolved": "https://registry.npmjs.org/@xyflow/react/-/react-12.4.2.tgz",
"integrity": "sha512-AFJKVc/fCPtgSOnRst3xdYJwiEcUN9lDY7EO/YiRvFHYCJGgfzg+jpvZjkTOnBLGyrMJre9378pRxAc3fsR06A==",
"version": "12.8.2",
"resolved": "https://registry.npmjs.org/@xyflow/react/-/react-12.8.2.tgz",
"integrity": "sha512-VifLpxOy74ck283NQOtBn1e8igmB7xo7ADDKxyBHkKd8IKpyr16TgaYOhzqVwNMdB4NT+m++zfkic530L+gEXw==",
"license": "MIT",
"dependencies": {
"@xyflow/system": "0.0.50",
"@xyflow/system": "0.0.66",
"classcat": "^5.0.3",
"zustand": "^4.4.0"
},
@@ -4618,16 +4618,18 @@
}
},
"node_modules/@xyflow/system": {
"version": "0.0.50",
"resolved": "https://registry.npmjs.org/@xyflow/system/-/system-0.0.50.tgz",
"integrity": "sha512-HVUZd4LlY88XAaldFh2nwVxDOcdIBxGpQ5txzwfJPf+CAjj2BfYug1fHs2p4yS7YO8H6A3EFJQovBE8YuHkAdg==",
"version": "0.0.66",
"resolved": "https://registry.npmjs.org/@xyflow/system/-/system-0.0.66.tgz",
"integrity": "sha512-TTxESDwPsATnuDMUeYYtKe4wt9v8bRO29dgYBhR8HyhSCzipnAdIL/1CDfFd+WqS1srVreo24u6zZeVIDk4r3Q==",
"license": "MIT",
"dependencies": {
"@types/d3-drag": "^3.0.7",
"@types/d3-interpolate": "^3.0.4",
"@types/d3-selection": "^3.0.10",
"@types/d3-transition": "^3.0.8",
"@types/d3-zoom": "^3.0.8",
"d3-drag": "^3.0.0",
"d3-interpolate": "^3.0.1",
"d3-selection": "^3.0.0",
"d3-zoom": "^3.0.0"
}

View File

@@ -43,7 +43,7 @@
"@radix-ui/react-toggle-group": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.8",
"@uidotdev/usehooks": "^2.4.1",
"@xyflow/react": "^12.3.1",
"@xyflow/react": "^12.8.2",
"ahooks": "^3.8.1",
"ai": "^3.3.14",
"class-variance-authority": "^0.7.1",

View File

@@ -1013,6 +1013,21 @@ export const Canvas: React.FC<CanvasProps> = ({ initialTables }) => {
overlapGraph
);
setOverlapGraph(newOverlappingGraph);
setTimeout(() => {
setNodes((prevNodes) =>
prevNodes.map((n) => {
if (n.id === event.data.id) {
return {
...n,
measured,
};
}
return n;
})
);
}, 0);
} else if (
event.action === 'add_field' ||
event.action === 'remove_field'
@@ -1052,7 +1067,14 @@ export const Canvas: React.FC<CanvasProps> = ({ initialTables }) => {
setOverlapGraph(overlappingTablesInDiagram);
}
},
[overlapGraph, setOverlapGraph, getNode, nodes, filteredSchemas]
[
overlapGraph,
setOverlapGraph,
getNode,
nodes,
filteredSchemas,
setNodes,
]
);
events.useSubscription(eventConsumer);