Skip to content

fix handle position, put orphan tables top left - #1796

Merged
william-schlegel merged 3 commits into
mainfrom
fix/datamodel-graph-handles-and-orphans
Aug 12, 2026
Merged

fix handle position, put orphan tables top left#1796
william-schlegel merged 3 commits into
mainfrom
fix/datamodel-graph-handles-and-orphans

Conversation

@william-schlegel

@william-schlegel william-schlegel commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

improve data model graph

Summary by CodeRabbit

  • New Features

    • Improved table relationship diagrams with directional connection handles that automatically adjust based on node positions.
    • Added automatic layout controls for clearer arrangement of linked and standalone tables.
    • Connection points now update when tables are moved or repositioned.
  • Bug Fixes

    • Improved layout consistency when updating diagrams and creating relationships.
    • Ensured the latest diagram state is used during automatic layout operations.

@coderabbitai coderabbitai Bot added enhancement New feature or request XL extra large labels Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bd178891-34e2-477b-bfde-54356de020f0

📥 Commits

Reviewing files that changed from the base of the PR and between cf23d8e and 940f990.

📒 Files selected for processing (1)
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableFlow.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableFlow.tsx
📜 Recent review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: check / main
  • GitHub Check: e2e
  • GitHub Check: Analyze (javascript-typescript)

📝 Walkthrough

Walkthrough

Changes

Data-model flow layout

Layer / File(s) Summary
Directional handle contracts and rendering
packages/app-builder/src/components/Data/SemanticTables/Flow/LinkRelation.tsx, packages/app-builder/src/components/Data/SemanticTables/Flow/TableDetails.tsx
Directional handle helpers support related and belongs-to links. SideHandles renders source and target handles on both sides of each node.
Edge handle retargeting
packages/app-builder/src/components/Data/SemanticTables/Flow/LinkRelation.tsx, packages/app-builder/src/components/Data/SemanticTables/Flow/TableFlow.tsx
Edge creation, synchronization, and node dragging select left or right handles from current node positions.
Automatic layout and current state wiring
packages/app-builder/src/components/Data/SemanticTables/Flow/TableFlow.tsx, packages/app-builder/src/components/ReactFlow.tsx
Automatic layout separates orphan nodes from linked nodes, positions both groups, retargets edges, preserves node order, and tracks the latest layout elements.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CustomControls
  participant TableFlow
  participant ReactFlow
  participant retargetDataModelHandles
  User->>CustomControls: Click automatic layout
  CustomControls->>TableFlow: Invoke onAutoLayout
  TableFlow->>ReactFlow: Apply linked and orphan node positions
  TableFlow->>retargetDataModelHandles: Update edge handle sides
  retargetDataModelHandles-->>TableFlow: Return updated edges
  TableFlow-->>ReactFlow: Apply layout elements
Loading

Possibly related PRs

Poem

Handles turn left, handles turn right,
Tables align in ordered flight.
Orphans climb a vertical rail,
Linked nodes follow Dagre’s trail.
Edges retarget, precise and bright.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: fixing handle positions and placing orphan tables in the top-left area.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/datamodel-graph-handles-and-orphans

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/app-builder/src/components/Data/SemanticTables/Flow/TableDetails.tsx (1)

19-19: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the @app-builder namespace import.

Line 19 imports a component through a relative path. Replace the changed import with its @app-builder namespace path.

As per coding guidelines: “Use internal imports from @app-builder namespace for models, queries, components, and utilities.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/app-builder/src/components/Data/SemanticTables/Flow/TableDetails.tsx`
at line 19, Update the import of belongsToHandleId and relatedHandleId from the
relative LinkRelation path to the corresponding `@app-builder` namespace import,
preserving the existing named-import usage.

Source: Coding guidelines

packages/app-builder/src/components/Data/SemanticTables/Flow/LinkRelation.tsx (1)

50-55: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use match for relation type selection.

Lines 50-55 and Lines 91-97 branch on relationType with boolean and ternary logic. Use match(original.relationType) to construct the source and target handles.

As per coding guidelines: “Use ts-pattern for pattern matching with the match function instead of conditional logic.”

Also applies to: 91-97

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/app-builder/src/components/Data/SemanticTables/Flow/LinkRelation.tsx`
around lines 50 - 55, Update the relation mapping logic around the visible
source/target handle construction and the corresponding block at lines 91-97 to
use ts-pattern’s match function on original.relationType instead of the
isRelated boolean and ternary expressions. Preserve the existing handle
selection for both 'related' and non-'related' relation types, including the
correct child/parent field and left/right handle arguments.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/app-builder/src/components/Data/SemanticTables/Flow/TableFlow.tsx`:
- Around line 162-168: Update the effect that builds the completed edge
collection so reused visible edges are retargeted using the current getNodes()
result before state storage. Ensure the existingEdge path in the edge-building
logic derives sourceHandle and targetHandle from the current node positions
rather than default endpoints, while preserving the existing undefined-data
behavior.

---

Nitpick comments:
In
`@packages/app-builder/src/components/Data/SemanticTables/Flow/LinkRelation.tsx`:
- Around line 50-55: Update the relation mapping logic around the visible
source/target handle construction and the corresponding block at lines 91-97 to
use ts-pattern’s match function on original.relationType instead of the
isRelated boolean and ternary expressions. Preserve the existing handle
selection for both 'related' and non-'related' relation types, including the
correct child/parent field and left/right handle arguments.

In
`@packages/app-builder/src/components/Data/SemanticTables/Flow/TableDetails.tsx`:
- Line 19: Update the import of belongsToHandleId and relatedHandleId from the
relative LinkRelation path to the corresponding `@app-builder` namespace import,
preserving the existing named-import usage.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 18ba505f-780f-429b-9c53-3ab8c1b7dba5

📥 Commits

Reviewing files that changed from the base of the PR and between d367c22 and cf23d8e.

📒 Files selected for processing (4)
  • packages/app-builder/src/components/Data/SemanticTables/Flow/LinkRelation.tsx
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableDetails.tsx
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableFlow.tsx
  • packages/app-builder/src/components/ReactFlow.tsx
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: check / main
  • GitHub Check: e2e
  • GitHub Check: Analyze (javascript-typescript)
🧰 Additional context used
📓 Path-based instructions (2)
packages/app-builder/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

packages/app-builder/src/**/*.{ts,tsx}: Use internal imports from @app-builder namespace for models, queries, components, and utilities
Use ui-design-system package for UI components (Button, Modal, Select) and utility functions (cn)
Use TanStack Query hooks with naming convention useGetXyzQuery for data fetching operations
Use ts-pattern for pattern matching with the match function instead of conditional logic
Use TanStack Form for form handling instead of manual form state management

Files:

  • packages/app-builder/src/components/Data/SemanticTables/Flow/LinkRelation.tsx
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableDetails.tsx
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableFlow.tsx
  • packages/app-builder/src/components/ReactFlow.tsx
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use Tailwind CSS 4 with the tailwind-preset package for consistent styling across packages

Files:

  • packages/app-builder/src/components/Data/SemanticTables/Flow/LinkRelation.tsx
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableDetails.tsx
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableFlow.tsx
  • packages/app-builder/src/components/ReactFlow.tsx
🧠 Learnings (4)
📚 Learning: 2026-05-11T13:00:53.337Z
Learnt from: william-schlegel
Repo: checkmarble/marble-frontend PR: 1503
File: packages/app-builder/src/components/ContinuousScreening/context/ListAndTopicDatasetConfigurationBridge.tsx:13-20
Timestamp: 2026-05-11T13:00:53.337Z
Learning: In checkmarble/marble-frontend, calls to `createSharp` from the `sharpstate` library should be treated as if they were a React hook. In React `.tsx` components, call `createSharp` unconditionally at the top level of the component function body (not inside conditionals or nested functions). Do not place `createSharp` inside `useMemo`, `useCallback`, `useEffect`, or any other hook, and do not suggest wrapping it in `useMemo`—that is incorrect and should be flagged during review.

Applied to files:

  • packages/app-builder/src/components/Data/SemanticTables/Flow/LinkRelation.tsx
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableDetails.tsx
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableFlow.tsx
  • packages/app-builder/src/components/ReactFlow.tsx
📚 Learning: 2026-06-04T14:37:05.664Z
Learnt from: william-schlegel
Repo: checkmarble/marble-frontend PR: 1603
File: packages/app-builder/src/components/Settings/ScreeningProviders/ScreeningProvidersSettingsPage.tsx:103-105
Timestamp: 2026-06-04T14:37:05.664Z
Learning: When using the `Callout` component from `app-builder/components/Callout`, you do not need to wrap the component in a conditional just to avoid an empty box. `Callout` is established to render `null` (nothing) when it receives no children, so passing `children={null}` or `children={undefined}` is safe and will result in no visible output.

Applied to files:

  • packages/app-builder/src/components/Data/SemanticTables/Flow/LinkRelation.tsx
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableDetails.tsx
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableFlow.tsx
  • packages/app-builder/src/components/ReactFlow.tsx
📚 Learning: 2026-05-12T19:51:39.619Z
Learnt from: Pascal-Delange
Repo: checkmarble/marble-frontend PR: 1522
File: packages/app-builder/src/components/Cases/CaseAlerts.tsx:449-449
Timestamp: 2026-05-12T19:51:39.619Z
Learning: In React (.tsx) files, when rendering translated strings that include dynamic count values, always use i18n interpolation rather than appending the count as a separate raw React text node. Prefer `t('translation.key', { count })` (or the project’s equivalent) and include `{{count}}` (or the interpolation placeholder expected by the i18n setup) inside the translation string so each locale controls placement/order. Avoid patterns like `t('key') + ' (' + count + ')'` or rendering `t('key')` followed by `(${count})` as separate nodes, since this can break RTL layout (e.g., Arabic).

Applied to files:

  • packages/app-builder/src/components/Data/SemanticTables/Flow/LinkRelation.tsx
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableDetails.tsx
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableFlow.tsx
  • packages/app-builder/src/components/ReactFlow.tsx
📚 Learning: 2026-06-17T15:50:44.228Z
Learnt from: william-schlegel
Repo: checkmarble/marble-frontend PR: 1652
File: packages/app-builder/src/components/Scenario/Actions/ArchiveScenario.tsx:67-72
Timestamp: 2026-06-17T15:50:44.228Z
Learning: When using `Modal.FooterButton` (or similar buttons) with an `isLoading`/`isPending` prop, do not rely on `pointer-events-none` alone to prevent all user re-triggering. In `packages/ui-design-system/src/Modal/Modal.tsx`, `isLoading` applies `pointer-events-none` but only sets the HTML `disabled` attribute when `disabled && !isLoading`, so keyboard activation (Enter/Space) can still occur during loading.

During loading/mutation pending, ensure keyboard users can’t re-trigger by either:
- adding an early return guard in the action handler (e.g., `if (mutation.isPending) return;`), and/or
- passing `disabled={isPending}` (or an equivalent) to `Modal.FooterButton` alongside `isLoading`/`isPending` so the button is truly disabled.

Applied to files:

  • packages/app-builder/src/components/Data/SemanticTables/Flow/LinkRelation.tsx
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableDetails.tsx
  • packages/app-builder/src/components/Data/SemanticTables/Flow/TableFlow.tsx
  • packages/app-builder/src/components/ReactFlow.tsx
🔇 Additional comments (4)
packages/app-builder/src/components/Data/SemanticTables/Flow/LinkRelation.tsx (1)

32-45: LGTM!

packages/app-builder/src/components/Data/SemanticTables/Flow/TableDetails.tsx (1)

23-58: LGTM!

Also applies to: 134-135, 194-194

packages/app-builder/src/components/Data/SemanticTables/Flow/TableFlow.tsx (1)

33-39: LGTM!

Also applies to: 178-178, 193-202, 356-395, 400-485

packages/app-builder/src/components/ReactFlow.tsx (1)

30-30: LGTM!

Comment thread packages/app-builder/src/components/Data/SemanticTables/Flow/TableFlow.tsx Outdated
@coderabbitai coderabbitai Bot removed enhancement New feature or request XL extra large labels Aug 11, 2026

@ChibiBlasphem ChibiBlasphem left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@william-schlegel
william-schlegel enabled auto-merge (squash) August 12, 2026 07:31
@william-schlegel
william-schlegel merged commit 0523c0f into main Aug 12, 2026
7 checks passed
@william-schlegel
william-schlegel deleted the fix/datamodel-graph-handles-and-orphans branch August 12, 2026 07:35
@coderabbitai coderabbitai Bot mentioned this pull request Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants