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, 09:30 UTC
perf: debounce toolkit search filtering
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sushmithamallesh committed
Feb 11, 2026 at 21:13 UTC
300cf0f1b0eeb7ccf74cac660ec8b452d5303e10
1 file changed
+13
-6
docs/components/toolkits/toolkits-landing.tsx
+13
-6
@@ -1,6 +1,6 @@
1
'use client';
2
3
-import { useState, useMemo } from 'react';
3
+import { useState, useMemo, useEffect, useRef } from 'react';
4
import Link from 'next/link';
5
import { Search, Sparkles, ArrowRight, Wrench, Zap, Copy, Check, ExternalLink, Grip } from 'lucide-react';
6
import toolkitsData from '@/public/data/toolkits-list.json';
@@ -97,6 +97,13 @@ function ToolkitRow({ toolkit }: { toolkit: ToolkitSummary }) {
97
98
export function ToolkitsLanding() {
99
const [search, setSearch] = useState('');
100
+ const [debouncedSearch, setDebouncedSearch] = useState('');
101
+ const debounceRef = useRef<ReturnType<typeof setTimeout>>();
102
+
103
+ useEffect(() => {
104
+ debounceRef.current = setTimeout(() => setDebouncedSearch(search), 150);
105
+ return () => clearTimeout(debounceRef.current);
106
+ }, [search]);
107
108
// Get popular toolkits
109
const popularToolkits = useMemo(() => {
@@ -106,15 +113,15 @@ export function ToolkitsLanding() {
113
}, []);
114
115
const filteredToolkits = useMemo(() => {
109
- if (!search) return toolkits;
116
+ if (!debouncedSearch) return toolkits;
117
111
- const searchLower = search.toLowerCase();
118
+ const searchLower = debouncedSearch.toLowerCase();
119
return toolkits.filter(
120
(toolkit) =>
121
toolkit.name.toLowerCase().includes(searchLower) ||
122
toolkit.slug.toLowerCase().includes(searchLower)
123
);
117
- }, [search]);
124
+ }, [debouncedSearch]);
125
126
// Group by first letter (numbers at end)
127
const groupedToolkits = useMemo(() => {
@@ -208,11 +215,11 @@ export function ToolkitsLanding() {
215
{/* Results count */}
216
<p className="text-sm text-fd-muted-foreground">
217
{filteredToolkits.length} toolkit{filteredToolkits.length !== 1 ? 's' : ''}
211
- {search && ` matching "${search}"`}
218
+ {debouncedSearch && ` matching "${debouncedSearch}"`}
219
</p>
220
221
{/* Popular Toolkits - only show when no search */}
215
- {!search && popularToolkits.length > 0 && (
222
+ {!debouncedSearch && popularToolkits.length > 0 && (
223
<div>
224
<h2 className="mb-2 text-sm font-semibold text-fd-muted-foreground">Popular</h2>
225
<div className="divide-y divide-fd-border">