Skip to content

ENG-1693 Add insert backlink checkbox to ModifyNodeModal#1018

Open
trangdoan982 wants to merge 4 commits into
eng-1626-pre-fill-the-create-node-dialog-title-field-with-currentlyfrom
eng-1693-add-insert-backlink-with-default-yes
Open

ENG-1693 Add insert backlink checkbox to ModifyNodeModal#1018
trangdoan982 wants to merge 4 commits into
eng-1626-pre-fill-the-create-node-dialog-title-field-with-currentlyfrom
eng-1693-add-insert-backlink-with-default-yes

Conversation

@trangdoan982
Copy link
Copy Markdown
Member

@trangdoan982 trangdoan982 commented May 11, 2026

https://www.loom.com/share/2c08071a85d849f0b13e828541a0a429

Summary

  • Adds an Insert backlink checkbox at the bottom of ModifyNodeModal (create mode only)
  • Smart defaults based on context — no new props needed:
    • true when the modal is opened with pre-filled text (user had text selected before invoking)
    • true when the user selects an existing node from the search
    • false when opened with no selected text (blank create)
    • User can always toggle the checkbox manually
  • Gates backlink insertion in both the canvas flow (nodeCreationFlow.ts) and the editor command flow (registerCommands.ts) on the checkbox value

Test plan

  • Open "Create discourse node" with no selected text → checkbox unchecked; submitting does not insert backlink
  • Select text in editor, open via right-click or command → checkbox checked; submitting inserts backlink at cursor
  • Open modal, pick an existing node from search → checkbox auto-checks; submitting inserts backlink
  • Open modal, pick existing node, clear selection → checkbox resets to initial default
  • User manually toggles checkbox in any case → submission respects the toggled value
  • Canvas: Don't show Insert backlink

Closes ENG-1693

🤖 Generated with Claude Code

@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 11, 2026

ENG-1693

@supabase
Copy link
Copy Markdown

supabase Bot commented May 11, 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 ↗︎.

@trangdoan982 trangdoan982 force-pushed the eng-1693-add-insert-backlink-with-default-yes branch from 8c687f1 to 076bf8a Compare May 11, 2026 22:22
@trangdoan982 trangdoan982 changed the base branch from main to eng-1626-pre-fill-the-create-node-dialog-title-field-with-currently May 11, 2026 22:26
@trangdoan982 trangdoan982 force-pushed the eng-1693-add-insert-backlink-with-default-yes branch 4 times, most recently from 9ef1a35 to be20fdc Compare May 11, 2026 23:21
…efaults

- Add "Insert backlink" checkbox to ModifyNodeModal (create mode only)
- Default true when pre-filled text exists (user had text selected) or existing node is chosen; false otherwise
- Gate backlink insertion in canvas flow and editor command flow on checkbox value

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@trangdoan982 trangdoan982 force-pushed the eng-1693-add-insert-backlink-with-default-yes branch from be20fdc to 98af9b1 Compare May 11, 2026 23:30
@trangdoan982 trangdoan982 requested a review from mdroidian May 11, 2026 23:48
Copy link
Copy Markdown
Member

@mdroidian mdroidian left a comment

Choose a reason for hiding this comment

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

Requesting changes because this introduces a bug in the canvas create-node flow.

Broader design concern

Separate from the immediate bug, I’m worried about ModifyNodeModal continuing to accumulate workflow-specific props and submit fields.

The modal is now responsible for:

  • create mode
  • edit mode
  • existing-node search
  • relationship creation
  • editor insertion
  • canvas creation behavior
  • backlink insertion

That makes the function hard to track because the meaning of a submit field depends heavily on which caller opened the modal.

It also makes bugs hard to debug. insertBacklink is a good example: in an editor flow, it means “insert a wikilink into the editor.” In the canvas flow, it ended up controlling whether the shape gets the blockref it needs to resolve to a file. Those are very different side effects hidden behind the same boolean.

I’d prefer we make caller capabilities explicit instead of inferring them inside the modal from global workspace state, and avoid using one generic submit payload for unrelated workflows. But we can continue that exploration in ENG-1750: Refactor Obsidian ModifyNodeModal contract for clearer workflow ownership

canvasFile,
linkedFile: fileToUse,
});
const src = insertBacklink
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app Bot commented May 13, 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

@trangdoan982 trangdoan982 requested a review from mdroidian May 24, 2026 03:56
@mdroidian
Copy link
Copy Markdown
Member

@codex review

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: 6ba4a87f7d

ℹ️ 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".

</div>
)}

{!isEditMode && hasEditorContext && (
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Hide backlink toggle when submit handler can't honor it

Rendering the checkbox whenever hasEditorContext is true exposes it in create flows whose onSubmit handlers do not consume insertBacklink (for example, the image-conversion and tag-node handlers), so users can uncheck Insert backlink and still get link replacement behavior. This makes the new control a no-op in those contexts and breaks the expectation that manual toggles are respected; gate this UI on caller support (or thread insertBacklink through all submit handlers).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

@mdroidian mdroidian left a comment

Choose a reason for hiding this comment

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

Could you submit a video showing that the bug as been fixed?

Also, please take a look at #1018 (comment)

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