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): simplify keyboard shortcut listener to avoid stale guard
Use a stable module-level handler reference so duplicate addEventListener calls are no-ops. Removes the shortcutRegistered flag that could get stuck. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sushmithamallesh committed
Feb 19, 2026 at 16:22 UTC
1944f8e3c54265e48e36d6c7f35a54a4b7808799
1 file changed
+7
-13
docs/components/ask-ai-button.tsx
+7
-13
@@ -23,23 +23,17 @@ function useIsMac() {
23
return isMac;
24
}
25
26
-let shortcutRegistered = false;
26
+const handleKeyDown = (e: KeyboardEvent) => {
27
+ if ((e.metaKey || e.ctrlKey) && e.key === 'i') {
28
+ e.preventDefault();
29
+ showDecimalWidget();
30
+ }
31
+};
32
33
function useAskAIShortcut() {
34
useEffect(() => {
30
- if (shortcutRegistered) return;
31
- shortcutRegistered = true;
32
- function handleKeyDown(e: KeyboardEvent) {
33
- if ((e.metaKey || e.ctrlKey) && e.key === 'i') {
34
- e.preventDefault();
35
- showDecimalWidget();
36
- }
37
- }
35
document.addEventListener('keydown', handleKeyDown);
39
- return () => {
40
- document.removeEventListener('keydown', handleKeyDown);
41
- shortcutRegistered = false;
42
- };
36
+ return () => document.removeEventListener('keydown', handleKeyDown);
37
}, []);
38
}
39