From e66e344f1cd9f26faa48faaef8df7e50237838b8 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Wed, 1 Oct 2025 10:58:34 -0600 Subject: [PATCH] short cuts need to track by id --- .../features/input/BusterChatInput/BusterChatInputBase.tsx | 1 + .../Mentions/ShortcutsSuggestions/ShortcutsSuggestions.tsx | 4 ++-- .../ui/inputs/MentionInput/MentionInput.stories.tsx | 2 +- .../src/components/ui/inputs/MentionInput/MentionPill.tsx | 2 +- .../ui/inputs/MentionInput/defaultQueryMentionsFilter.ts | 6 ++++++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/apps/web/src/components/features/input/BusterChatInput/BusterChatInputBase.tsx b/apps/web/src/components/features/input/BusterChatInput/BusterChatInputBase.tsx index 59badf02b..1e3ceed1c 100644 --- a/apps/web/src/components/features/input/BusterChatInput/BusterChatInputBase.tsx +++ b/apps/web/src/components/features/input/BusterChatInput/BusterChatInputBase.tsx @@ -100,6 +100,7 @@ export const BusterChatInputBase: React.FC = React.memo( console.warn('Input is disabled or value is not defined'); return; } + onSubmit({ ...value, mode }); }; diff --git a/apps/web/src/components/features/input/Mentions/ShortcutsSuggestions/ShortcutsSuggestions.tsx b/apps/web/src/components/features/input/Mentions/ShortcutsSuggestions/ShortcutsSuggestions.tsx index b204b8f6b..5142d0015 100644 --- a/apps/web/src/components/features/input/Mentions/ShortcutsSuggestions/ShortcutsSuggestions.tsx +++ b/apps/web/src/components/features/input/Mentions/ShortcutsSuggestions/ShortcutsSuggestions.tsx @@ -73,7 +73,7 @@ export const useCreateShortcutsMentionsSuggestions = ( popoverContent: ShortcutPopoverContent, popoverClassName: '', onChangeTransform: (v) => { - const foundShortcut = shortcuts.find((shortcut) => shortcut.name === v.label); + const foundShortcut = shortcuts.find((shortcut) => shortcut.id === v.value); if (foundShortcut) { return foundShortcut.instructions; } @@ -91,9 +91,9 @@ export const useCreateShortcutForMention = () => { shortcut: Shortcut, _editor?: Editor ): MentionTriggerItem => { - console.log('shortcut', shortcut); return { value: shortcut.id, + labelMatches: [shortcut.name, shortcut.instructions], label: (
{`${SHORTCUT_MENTION_TRIGGER}${shortcut.name}`} diff --git a/apps/web/src/components/ui/inputs/MentionInput/MentionInput.stories.tsx b/apps/web/src/components/ui/inputs/MentionInput/MentionInput.stories.tsx index f64231fb0..24e5c46f4 100644 --- a/apps/web/src/components/ui/inputs/MentionInput/MentionInput.stories.tsx +++ b/apps/web/src/components/ui/inputs/MentionInput/MentionInput.stories.tsx @@ -427,7 +427,7 @@ export const DynamicItems: Story = { placeholder="Type ! to see dynamic mentions..." mentions={[dynamicSuggestions]} onChange={(value) => { - console.log('Input changed:', value); + console.info('Input changed:', value); }} /> diff --git a/apps/web/src/components/ui/inputs/MentionInput/MentionPill.tsx b/apps/web/src/components/ui/inputs/MentionInput/MentionPill.tsx index e8e7f4b6a..a8f47ba5d 100644 --- a/apps/web/src/components/ui/inputs/MentionInput/MentionPill.tsx +++ b/apps/web/src/components/ui/inputs/MentionInput/MentionPill.tsx @@ -60,7 +60,7 @@ const PopoverWrapper = ({ return ( { return results.length > 0; } + if (typeof item.pillLabel === 'string') { + const pillLabelFuse = new Fuse([item.pillLabel], fuseConfig); + const results = pillLabelFuse.search(query); + return results.length > 0; + } + // No match if label is not a string and no labelMatches provided return false; };