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, 14:30 UTC
fix(docs): fix Card regex and feedback modal timeout cleanup
- Card regex now handles Cards with children content, not just self-closing Cards with description attribute - Feedback modal timeout is now properly cleared when user closes modal early, preventing race condition that could clear user input Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sushmithamallesh committed
Jan 19, 2026 at 16:54 UTC
75bf8c311f81ec49bc122e7425f858aa18791dbf
2 files changed
+26
-2
docs/components/feedback.tsx
+15
-2
@@ -1,6 +1,6 @@
1
'use client';
2
3
-import { useState } from 'react';
3
+import { useState, useRef, useEffect } from 'react';
4
import { MessageSquare, X, Loader2 } from 'lucide-react';
5
6
type Sentiment = 'positive' | 'neutral' | 'negative' | null;
@@ -15,6 +15,15 @@ export function Feedback({ page }: FeedbackProps) {
15
const [message, setMessage] = useState('');
16
const [email, setEmail] = useState('');
17
const [state, setState] = useState<'idle' | 'loading' | 'success' | 'error'>('idle');
18
+ const closeTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
19
+
20
+ useEffect(() => {
21
+ return () => {
22
+ if (closeTimeoutRef.current) {
23
+ clearTimeout(closeTimeoutRef.current);
24
+ }
25
+ };
26
+ }, []);
27
28
const handleSubmit = async (e: React.FormEvent) => {
29
e.preventDefault();
@@ -37,7 +46,7 @@ export function Feedback({ page }: FeedbackProps) {
46
if (!response.ok) throw new Error('Failed to send');
47
48
setState('success');
40
- setTimeout(() => {
49
+ closeTimeoutRef.current = setTimeout(() => {
50
setIsOpen(false);
51
setState('idle');
52
setSentiment(null);
@@ -50,6 +59,10 @@ export function Feedback({ page }: FeedbackProps) {
59
};
60
61
const handleClose = () => {
62
+ if (closeTimeoutRef.current) {
63
+ clearTimeout(closeTimeoutRef.current);
64
+ closeTimeoutRef.current = null;
65
+ }
66
setIsOpen(false);
67
setState('idle');
68
setSentiment(null);
docs/lib/source.ts
+11
@@ -82,10 +82,21 @@ function mdxToCleanMarkdown(content: string): string {
82
);
83
84
// Convert Card - handle multiline and various attribute orders
85
+ // Self-closing Cards with description attribute
86
result = result.replace(
87
/<Card[\s\S]*?title="([^"]*)"[\s\S]*?href="([^"]*)"[\s\S]*?description="([^"]*)"[\s\S]*?\/>/g,
88
'- [$1]($2): $3'
89
);
90
+ // Cards with children content (non-self-closing)
91
+ result = result.replace(
92
+ /<Card[\s\S]*?title="([^"]*)"[\s\S]*?href="([^"]*)"[\s\S]*?>([\s\S]*?)<\/Card>/g,
93
+ '- [$1]($2): $3'
94
+ );
95
+ // Cards with href before title
96
+ result = result.replace(
97
+ /<Card[\s\S]*?href="([^"]*)"[\s\S]*?title="([^"]*)"[\s\S]*?>([\s\S]*?)<\/Card>/g,
98
+ '- [$2]($1): $3'
99
+ );
100
101
// Convert ProviderCard to markdown link
102
result = result.replace(