Missing relation line in Show Key Only/All Fileds visualization
Self Checks
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing issues, including closed ones.
Version Type
CLI Version (npm package)
Version (only for Self Hosted)
v0.4.3 + 4a6deae (2025-02-26)
Steps to reproduce
Use attached schema
Expected Behavior
The relation are correctly visualized
Actual Behavior
When in show Key Only and Show All Fields visualization, the rectangle are correctly light up but the connection line is missing.
Additional Context
No problem in table name visualization
I'm currently investigating this issue with the missing relation lines in the Show Key Only/All Fields visualization. Will provide a detailed analysis shortly.
Investigation Results: Missing Relation Lines in Show Key Only/All Fields Visualization
After analyzing the provided schema.json file and the codebase, I've identified the likely cause of the missing relation lines in the "Show Key Only" and "All Fields" visualization modes.
Findings
-
The
schema.jsonfile contains properly defined relationships in therelationshipssection:"relationships": { "relationshipNo3": { "name": "relationshipNo3", "primaryTableName": "img_image", "primaryColumnName": "IMG_IMAGE_ID", "foreignTableName": "img_image_save", "foreignColumnName": "IMG_IMAGE_ID", "cardinality": "ONE_TO_MANY", "updateConstraint": "NO_ACTION", "deleteConstraint": "NO_ACTION" }, // Other relationships... } -
The issue appears to be in how the edges are rendered in different show modes. In the
convertDBStructureToNodes.tsfile, edges are created with specific sourceHandle and targetHandle properties that depend on the showMode:sourceHandle: showMode === 'TABLE_NAME' ? null : columnHandleId(rel.primaryTableName, rel.primaryColumnName), targetHandle: showMode === 'TABLE_NAME' ? null : columnHandleId(rel.foreignTableName, rel.foreignColumnName), -
While the edges are being created correctly for all show modes, the rendering of the edges in the "Show Key Only" and "All Fields" modes is not working properly. The rectangles (tables) are correctly highlighted, but the connection lines are missing.
-
The
RelationshipEdge.tsxcomponent is responsible for rendering the edges, but it may not be handling the different show modes correctly, particularly when sourceHandle and targetHandle are specified.
Potential Causes
-
Handle Positioning Issue: The most likely cause is that the handle positions for columns in "Show Key Only" and "All Fields" modes are not being calculated correctly, causing the edges to be rendered incorrectly or not at all.
-
Edge Path Calculation: The
getBezierPathfunction inRelationshipEdge.tsxmight not be correctly calculating the path when specific column handles are used. -
Schema-specific Issue: The specific structure of the provided schema might be triggering an edge case in the visualization logic that wasn't previously encountered.
Verification
The issue is reproducible with the provided schema.json file, and as shown in the screenshots:
- The relation rectangles are correctly highlighted
- The connection lines are missing in "Show Key Only" and "All Fields" modes
- The "Table Name" visualization mode works correctly
This suggests that the issue is specific to how column-level relationships are rendered in these visualization modes.
@ac2780 Thanks for reporting! Looks like a UI issue to me. Devin couldn't solve the problem 😅
📝 The relationship that has a problem is this:
"relationshipNo5": {
"name": "relationshipNo5",
"primaryTableName": "img_image_save",
"primaryColumnName": "IMG_OVERLAY_ID",
"foreignTableName": "img_overlay",
"foreignColumnName": "IMG_OVERLAY_ID",
"cardinality": "ONE_TO_ONE",
"updateConstraint": "NO_ACTION",
"deleteConstraint": "NO_ACTION"
},
@ac2780
The problem is that the primaries and foreigns are reversed (same with https://github.com/liam-hq/liam/issues/786)
Please check the values of relationshipNo6 and relationshipNo7.
One way to prevent unintended inversions might be to show a warning in the application when a column specified as a foreign key in a relationship is also the primary key of the table.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.