Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/roam/src/components/canvas/DiscourseNodeUtil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,9 @@ export class DiscourseNodeUtil extends BaseBoxShapeUtil<DiscourseNodeShape> {
mode: isCreating ? "create" : "edit",
nodeType: getDiscourseNodeTypeId({ shape }),
initialValue: { text: initialTitle, uid: shape.props.uid },
// Only pass it when editing an existing node that has a valid Roam block UID
// Block nodes only: updateBlock on a page uid stores a block string on the page, and Roam then refuses to rename it
sourceBlockUid:
!isCreating && isLiveBlock(shape.props.uid)
!isCreating && !isPageUid(shape.props.uid)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Edit mode passed every live uid as sourceBlockUid, and isLiveBlock is true for pages too. ModifyNodeDialog then called updateBlock on the page uid before onSuccess called updatePage. Roam keeps that :block/string on the page and rejects every later updatePage with "is a block, not a page". Its own title editor stops saving too.

Page nodes now get no sourceBlockUid, so the only write is the updatePage in onSuccess. Block nodes keep the old path. This is the only mode: "edit" caller of renderModifyNodeDialog, so the fix lives here rather than in ModifyNodeDialog.

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.

🟡 Canvas page renames lack regression coverage

When sourceBlockUid excludes pages, no unit test checks that page edits avoid block writes while block edits still work. The canvas rename fix remains unguarded against regression.

Learn more

The canvas node edit flow passes a source block UID to the dialog only for block nodes. The dialog writes that UID with onSubmit, while the canvas success callback handles page renames. This change fixes the page case but does not add a test for either side of the new branch. Repository contribution rules require tests that validate fixes.

Example: Editing page P must call the page rename API without updating block P; editing block B must still update block B.

Recommended fix: Add a focused test for the canvas dialog props or extract the page-versus-block source UID decision into a testable helper. Cover both page and block UIDs, including the call that persists the page title.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

? shape.props.uid
: undefined,
extensionAPI,
Expand Down
Loading