Skip to content

ENG-1136: Notify user when suggestive mode suggestion is adopted (Roam)#1145

Open
trangdoan982 wants to merge 8 commits into
mainfrom
eng-1136-notify-user-when-suggestive-mode-suggested-node-is-added-to
Open

ENG-1136: Notify user when suggestive mode suggestion is adopted (Roam)#1145
trangdoan982 wants to merge 8 commits into
mainfrom
eng-1136-notify-user-when-suggestive-mode-suggested-node-is-added-to

Conversation

@trangdoan982

@trangdoan982 trangdoan982 commented Jun 22, 2026

Copy link
Copy Markdown
Member

Summary

When a user adopts a suggestion in Suggestive Mode (Roam), they now receive clear feedback about where the content was added:

  • Target page open in main window → shows a brief toast: Added to [[Page Name]]
  • disableSidebarOpen setting enabled → shows the same toast instead of opening the sidebar
  • Target page already in sidebar → brings the existing sidebar window to the top
  • Otherwise → opens the target page in the right sidebar

For reified relation adoptions (when Stored Relations are enabled), a toast confirms the relation was created: Added relation between [[Source]] and [[Destination]].

Changes

  • apps/roam/src/utils/notifySuggestiveModeAdoption.ts (new) — notification logic for block and relation suggestion adoption
  • apps/roam/src/components/SuggestionsBody.tsx — wires notifyBlockSuggestionAdded / notifyRelationSuggestionAdded into handleCreateBlock

Test plan

  • Suggestive Mode: adopt a suggestion while the target page is open in the main window → toast appears
  • Suggestive Mode: adopt a suggestion while the target page is not open → page opens in right sidebar
  • Suggestive Mode: adopt a suggestion while the target page is already in the sidebar → sidebar window comes to the top
  • With disableSidebarOpen enabled: adopt a suggestion → toast appears regardless of sidebar state
  • With Stored Relations enabled: adopt a suggestion → relation toast appears (no sidebar navigation)

When a user adopts a suggestion in Suggestive Mode:
- Shows a toast "Added to [[Page Name]]" if the target page is already open in the main window or if sidebar navigation is disabled
- Opens the target page in the right sidebar (or brings it to the top if already open) otherwise
- Shows a toast confirming the created relation when a reified relation is adopted instead of a block

Adds a new `notifySuggestiveModeAdoption` utility to keep notification logic separate from `SuggestionsBody`.

Co-authored-by: Cursor <cursoragent@cursor.com>
@linear-code

linear-code Bot commented Jun 22, 2026

Copy link
Copy Markdown

ENG-1136

@supabase

supabase Bot commented Jun 22, 2026

Copy link
Copy Markdown

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 ↗︎.

@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
discourse-graph Skipped Skipped Jun 22, 2026 11:57pm

Request Review

@devin-ai-integration devin-ai-integration Bot 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.

Devin Review found 2 potential issues.

Open in Devin Review

Comment thread apps/roam/src/components/SuggestionsBody.tsx Outdated
Comment thread apps/roam/src/utils/notifySuggestiveModeAdoption.ts Outdated
Only add notifySuggestiveModeAdopted at the end of the success path;
don't restructure the existing if/else branches.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread apps/roam/src/utils/notifySuggestiveModeAdoption.ts Outdated
- Replace "adopted/adoption" naming with "added" throughout
- Split single export with discriminated union into two direct functions:
  notifyBlockSuggestionAdded and notifyRelationSuggestionAdded
- Inline one-off helpers: getSidebarWindows, findOutlineSidebarWindowId,
  resolveTargetPageUid
- Merge bringSidebarWindowToTop + focusTopSidebarOutline into one
  focusSidebarOutline(windowId?, delayMs?), removing the buggy global
  fallback selector when a specific windowId is targeted
- Share a single showSuggestionToast for both toast paths

Co-authored-by: Cursor <cursoragent@cursor.com>
getCurrentPageUid() only parses the URL hash which can be stale or
incorrect when a block is focused. Use the official Roam API
getOpenPageOrBlockUid() (awaited properly since the caller is already
async) and resolve the result to a page uid before comparing.

Co-authored-by: Cursor <cursoragent@cursor.com>
trangdoan982 and others added 2 commits June 22, 2026 19:53
- Add comment to empty catch block to satisfy no-empty ESLint rule
- Wrap suggestion-added notifications in try/catch so posthog tracking
  and suggestion list removal still run if sidebar/toast logic fails

Co-authored-by: Cursor <cursoragent@cursor.com>
- Use relation wording for success toast in block-adoption path when showing
  feedback in main window/disableSidebarOpen mode
- Ensure sidebar-open path always targets outline windows and focuses the
  specific opened window so it is brought to the top

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment on lines +81 to +83
showSuggestionToast(
`Added relation between [[${sourceTitle}]] and [[${destinationTitle}]]`,
);

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.

Wrong toast message for block suggestions.

The toast says "Added relation between..." but this function handles block suggestions, not relation suggestions. According to the PR description, it should show: Added to [[Page Name]].

The message should reference the destination page, not both source and destination as a relation:

showSuggestionToast(
  `Added to [[${destinationTitle}]]`,
);

Currently, users adopting block suggestions see a confusing "Added relation" message even when no relation is being created.

Suggested change
showSuggestionToast(
`Added relation between [[${sourceTitle}]] and [[${destinationTitle}]]`,
);
showSuggestionToast(
`Added to [[${destinationTitle}]]`,
);

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

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