@devries-cameron20 / composio Mirror · read-only / commits / 6c6a7e9e5
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 08:15 UTC

fix(docs): prevent duplicate keyboard shortcut listeners for Ask AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Sushmithamallesh committed Feb 19, 2026 at 16:09 UTC 6c6a7e9e57520930c886b2d43996b34d6715c195
1 file changed +8 -2
docs/components/ask-ai-button.tsx
+8 -2
@@ -32,8 +32,12 @@ function useIsMac() {
32 return isMac;
33 }
34
35 +let shortcutRegistered = false;
36 +
37 function useAskAIShortcut() {
38 useEffect(() => {
39 + if (shortcutRegistered) return;
40 + shortcutRegistered = true;
41 function handleKeyDown(e: KeyboardEvent) {
42 if ((e.metaKey || e.ctrlKey) && e.key === 'i') {
43 e.preventDefault();
@@ -41,7 +45,10 @@ function useAskAIShortcut() {
45 }
46 }
47 document.addEventListener('keydown', handleKeyDown);
44 - return () => document.removeEventListener('keydown', handleKeyDown);
48 + return () => {
49 + document.removeEventListener('keydown', handleKeyDown);
50 + shortcutRegistered = false;
51 + };
52 }, []);
53 }
54
@@ -90,7 +97,6 @@ export function SearchAndAskAI() {
97 /** Mobile: search icon + Ask AI icon, shown below lg breakpoint */
98 export function SearchAndAskAIMobile() {
99 const { enabled, setOpenSearch } = useSearchContext();
93 - useAskAIShortcut();
100
101 return (
102 <>