Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing relation line in Show Key Only/All Fileds visualization #785

Open
2 tasks done
ac2780 opened this issue Feb 26, 2025 · 3 comments
Open
2 tasks done

Missing relation line in Show Key Only/All Fileds visualization #785

ac2780 opened this issue Feb 26, 2025 · 3 comments
Labels
Area: UI bug Something isn't working

Comments

@ac2780
Copy link

ac2780 commented Feb 26, 2025

schema.json

Self Checks

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.
Image

Image

Additional Context

No problem in table name visualization

Image

@ac2780 ac2780 added the bug Something isn't working label Feb 26, 2025
Copy link
Contributor

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.

Copy link
Contributor

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

  1. The schema.json file contains properly defined relationships in the relationships section:

    "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...
    }
  2. The issue appears to be in how the edges are rendered in different show modes. In the convertDBStructureToNodes.ts file, 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),
  3. 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.

  4. The RelationshipEdge.tsx component 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

  1. 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.

  2. Edge Path Calculation: The getBezierPath function in RelationshipEdge.tsx might not be correctly calculating the path when specific column handles are used.

  3. 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.

@MH4GF
Copy link
Member

MH4GF commented Feb 27, 2025

@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"
    },

@MH4GF MH4GF added the Area: UI label Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: UI bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants