Skip to content

ENG-1477: Convert a tldraw arrow to a DG relation#1082

Open
sid597 wants to merge 5 commits into
mainfrom
eng-1477-implement-ability-to-convert-a-tldraw-arrow-to-a-dg-relation
Open

ENG-1477: Convert a tldraw arrow to a DG relation#1082
sid597 wants to merge 5 commits into
mainfrom
eng-1477-implement-ability-to-convert-a-tldraw-arrow-to-a-dg-relation

Conversation

@sid597
Copy link
Copy Markdown
Collaborator

@sid597 sid597 commented May 25, 2026

No description provided.

Right-click a plain tldraw arrow connecting two discourse-graph nodes to
get a "Relation" submenu listing the relation types valid between those
node types. Selecting one creates the discourse relation (persisted to
Roam) and replaces the plain arrow with the relation arrow.

Extract the relation-creation logic shared with the node drag-handle flow
into overlays/relationCreation.ts (createRelationBetweenNodes,
getValidRelationTypesBetween); DragHandleOverlay and RelationTypeDropdown
now delegate to it.
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 25, 2026

ENG-1477

@supabase
Copy link
Copy Markdown

supabase Bot commented May 25, 2026

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08c8fb265e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/roam/src/components/canvas/uiOverrides.tsx Outdated
sid597 added 3 commits May 25, 2026 15:21
Converting a plain arrow deleted the original immediately after the new
relation shape was created, but persistence runs asynchronously and
deletes the new arrow on failure (e.g. canvas page UID lookup fails),
which could leave neither arrow.

Await handleCreateRelationsInRoam and treat the new arrow surviving as
success; the convert action now removes the original only when the
relation persisted. The drag-handle caller voids the now-async helper
(no original arrow to lose, behavior unchanged).
Drop the `sourceNode?.type ?? ""` lie that quietly proceeded past a
deleted source/target shape and let the binding step fail silently,
losing the original arrow with no toast. Return null early instead.

Also drop the `?? newArrow` fallback when re-reading the shape before
persistence; the read happens synchronously after createShape +
bindings, so there is no scenario where it returns undefined that we
should paper over.
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app Bot commented May 28, 2026

PR size/scope check

This PR is over our review-size guideline.

  • Recommended: ~200 lines changed
  • Acceptable limit: up to 400 lines when well-scoped/self-contained
  • Preferred file count: fewer than 5 files

Please split this into smaller PRs unless there is a clear reason the changes need to land together.

If keeping it as one PR, please add a brief justification covering:

  • What single problem this PR solves
  • Why the files/changes are coupled

…conversion

Pull the directional-label rule and the Roam-persistence call into shared
getDirectionalRelationLabel and persistRelationArrow helpers, used by both
the drag-handle creator and the conversion path (the label rule previously
lived in three places).

Convert now sets the relation's visual contract explicitly instead of
spreading the original arrow's props: it inherits only geometry (bend,
start, end, labelPosition) and forces color, label, arrowheads, dash, size,
font, scale, fill. Arrowheads encode relation direction, so a converted
double- or reverse-headed arrow would otherwise render a misdirected
relation; explicit props also stop future tldraw arrow props from leaking
into converted relations.
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.

1 participant