@devries-cameron20 / composio Mirror · read-only / commits / 2cf760ee1
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, 07:00 UTC

docs: fix glossary filter flicker on remount with callback ref

Replace useEffect with a callback ref so definition text is read synchronously on mount, preventing brief misses when terms remount. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Sushmitha Mallesh committed Feb 24, 2026 at 18:41 UTC 2cf760ee1747cbfc7bfe3e10ff91996d50bcbc14
1 file changed +4 -6
docs/components/glossary.tsx
+4 -6
@@ -2,10 +2,9 @@
2
3 import {
4 useState,
5 + useCallback,
6 createContext,
7 useContext,
7 - useRef,
8 - useEffect,
8 type ReactNode,
9 } from 'react';
10 import { cn } from '@/lib/utils';
@@ -73,13 +72,12 @@ export function GlossaryTerm({
72 children: ReactNode;
73 }) {
74 const filter = useContext(FilterContext);
76 - const definitionRef = useRef<HTMLDivElement>(null);
75 const [definitionText, setDefinitionText] = useState('');
76 const id = slugify(name);
77
80 - useEffect(() => {
81 - if (definitionRef.current) {
82 - setDefinitionText(definitionRef.current.textContent?.toLowerCase() || '');
78 + const definitionRef = useCallback((node: HTMLDivElement | null) => {
79 + if (node) {
80 + setDefinitionText(node.textContent?.toLowerCase() || '');
81 }
82 }, []);
83