Add mentions feature to objects in notes#16373
Conversation
… pattern to SingleRecordPickerMenu
packages/twenty-front/src/modules/ui/input/editor/hooks/useMentionMenu.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR adds a mentions feature to the BlockNote editor, allowing users to type @ to trigger a dropdown menu for selecting and linking to objects within notes.
Key changes:
- Added
MentionInlineContentto the BlockNote schema for rendering mentioned objects as clickableRecordChipcomponents - Implemented
useMentionMenuhook to fetch and filter searchable object records - Created
CustomMentionMenuandCustomMentionMenuListItemcomponents for the mention selection UI
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
packages/twenty-front/src/modules/ui/input/editor/hooks/useMentionMenu.ts |
Hook that fetches searchable objects and provides mention items for the suggestion menu |
packages/twenty-front/src/modules/ui/input/editor/components/types.ts |
Added MentionItem type definition extending DefaultReactSuggestionItem |
packages/twenty-front/src/modules/ui/input/editor/components/CustomMentionMenuListItem.tsx |
Component rendering individual items in the mention menu dropdown |
packages/twenty-front/src/modules/ui/input/editor/components/CustomMentionMenu.tsx |
Main mention menu component with keyboard navigation and selection support |
packages/twenty-front/src/modules/ui/input/editor/components/BlockEditor.tsx |
Integrated mention menu with @ trigger via SuggestionMenuController |
packages/twenty-front/src/modules/ui/input/constants/MentionMenuListId.ts |
Constant for mention menu selectable list identifier |
packages/twenty-front/src/modules/ui/input/constants/MentionMenuDropdownClickOutsideId.ts |
Constant for mention menu click-outside handling |
packages/twenty-front/src/modules/command-menu/components/CommandMenuOpenContainer.tsx |
Added mention menu dropdown to excluded click-outside IDs |
packages/twenty-front/src/modules/activities/blocks/constants/Schema.ts |
Extended BlockNote schema with mention inline content spec |
packages/twenty-front/src/modules/activities/blocks/components/MentionInlineContent.tsx |
React component that renders mentions as styled RecordChip components |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/twenty-front/src/modules/ui/input/editor/hooks/useMentionMenu.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/input/editor/components/CustomMentionMenu.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/ui/input/editor/components/CustomMentionMenu.tsx
Show resolved
Hide resolved
Greptile OverviewGreptile SummaryThis PR adds Key changes:
Architecture notes:
Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant BlockEditor
participant SuggestionMenuController
participant useMentionMenu
participant useObjectRecordSearchRecords
participant CustomMentionMenu
participant CustomMentionMenuListItem
participant MentionInlineContent
participant useFindOneRecord
User->>BlockEditor: Types "@"
BlockEditor->>SuggestionMenuController: Trigger "@" character
SuggestionMenuController->>useMentionMenu: getItems(query)
useMentionMenu->>useObjectRecordSearchRecords: searchInput = query
useObjectRecordSearchRecords-->>useMentionMenu: searchRecords[]
useMentionMenu-->>SuggestionMenuController: MentionItem[]
SuggestionMenuController->>CustomMentionMenu: render(items)
CustomMentionMenu->>CustomMentionMenuListItem: render each item
User->>CustomMentionMenuListItem: Clicks item
CustomMentionMenuListItem->>useMentionMenu: onItemClick()
useMentionMenu->>BlockEditor: insertInlineContent(mention)
BlockEditor->>MentionInlineContent: render mention
MentionInlineContent->>useFindOneRecord: fetch record data
useFindOneRecord-->>MentionInlineContent: record
MentionInlineContent-->>User: Display RecordChip
|
There was a problem hiding this comment.
Additional Comments (1)
-
packages/twenty-front/src/modules/ui/input/editor/hooks/useMentionMenu.ts, line 69-75 (link)logic: Potential race condition:
setSearchQuery(query)triggers an async state update, butmentionItemsis returned immediately with results from the previous query. On first keystroke, users may see stale/empty results until the next render cycle.
10 files reviewed, 1 comment
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:15717 This environment will automatically shut down when the PR is closed or after 5 hours. |
|
@Bonapara is this useful if it doesn't ping the user? I feel it's too early |
|
@charlesBochet I think it’s useful to be able to mention other records in notes, even without notifications, as long as you can mention a team member in v1. (It seems this PR only allows mentioning records from objects that are:
Which seems fine to me. Thanks a lot for raising this PR @acee3! It will bring a lot of value to Twenty. Two main pieces of feedback from a product/design perspective: |
… scrollable container within the external container instead of inside
|
@Bonapara Thanks for your response and feedback! I am a little bit confused about what you mean by using the relation chip component. I wasn't able to find one other than the RecordChip, which I was already using. I assumed you meant that the icon of the object should show, so I made some updates to that. If that is the case, I was able to implement all your changes.
Also, I don't think the failing CI front storybook test about network failure seems to be related to the change I just made. Other people seem to be getting the same exact failing test. |
|
Hi @acee3, yes indeed! For the rest, I couldn’t try your PR yet, as it seems you didn’t take permissions into account:
|
|
Hey @charlesBochet could you please re-review this when you have some freetime please ? |
|
@charlesBochet @prastoin @Bonapara Just checking in if there is anything I need to do to get this merged? |
FelixMalfait
left a comment
There was a problem hiding this comment.
Great work! Sorry we took so long to merge (this was the oldest PR on this repo), we weren't sure about the product direction going forward. I made very minor fixes (extract useEffect, handle the case where a record or objectMetadata is deleted, remove the extra "@" that was showing up, use objectMetadataId which is more robust over time than using the name)
There was a problem hiding this comment.
1 issue found across 12 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/twenty-front/src/modules/activities/blocks/components/MentionInlineContent.tsx">
<violation number="1" location="packages/twenty-front/src/modules/activities/blocks/components/MentionInlineContent.tsx:41">
P2: `Unknown object` is never shown when `objectMetadataId` is missing/invalid because the `!record` check runs first and `useFindOneRecord` is skipped, so `record` is undefined. This causes unknown objects to be mislabeled as deleted records.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
packages/twenty-front/src/modules/activities/blocks/components/MentionInlineContent.tsx
Outdated
Show resolved
Hide resolved
…ities Check for missing objectMetadata before missing record so invalid objectMetadataId correctly shows "Unknown object" instead of "Deleted record". Co-authored-by: Cursor <cursoragent@cursor.com>
|
Hey @FelixMalfait! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
1 similar comment
|
Hey @FelixMalfait! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |





Issue #15755
Context
As shown in the issue, users should be able to @ objects and have it be linked to their associated page.
Changes Made
Result
Screen.Recording.2025-12-05.at.2.56.34.PM.mov