Skip to content

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

fix(docs): fix Card regex and feedback modal timeout cleanup

Sushmithamallesh75bf8c311f81
diff --git a/docs/components/feedback.tsx b/docs/components/feedback.tsx
index 049f471b9..1725ba359 100644
--- a/docs/components/feedback.tsx
+++ b/docs/components/feedback.tsx
@@ -1,6 +1,6 @@
'use client';
-import { useState } from 'react';
+import { useState, useRef, useEffect } from 'react';
import { MessageSquare, X, Loader2 } from 'lucide-react';
type Sentiment = 'positive' | 'neutral' | 'negative' | null;
@@ -15,6 +15,15 @@ export function Feedback({ page }: FeedbackProps) {
const [message, setMessage] = useState('');
const [email, setEmail] = useState('');
const [state, setState] = useState<'idle' | 'loading' | 'success' | 'error'>('idle');
+ const closeTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
+
+ useEffect(() => {
+ return () => {
+ if (closeTimeoutRef.current) {
+ clearTimeout(closeTimeoutRef.current);
+ }
+ };
+ }, []);
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
@@ -37,7 +46,7 @@ export function Feedback({ page }: FeedbackProps) {
if (!response.ok) throw new Error('Failed to send');
setState('success');
- setTimeout(() => {
+ closeTimeoutRef.current = setTimeout(() => {
setIsOpen(false);
setState('idle');
setSentiment(null);
@@ -50,6 +59,10 @@ export function Feedback({ page }: FeedbackProps) {
};
const handleClose = () => {
+ if (closeTimeoutRef.current) {
+ clearTimeout(closeTimeoutRef.current);
+ closeTimeoutRef.current = null;
+ }
setIsOpen(false);
setState('idle');
setSentiment(null);
diff --git a/docs/lib/source.ts b/docs/lib/source.ts
index c00223372..eb9ae158f 100644
--- a/docs/lib/source.ts
+++ b/docs/lib/source.ts
@@ -82,10 +82,21 @@ function mdxToCleanMarkdown(content: string): string {
);
// Convert Card - handle multiline and various attribute orders
+ // Self-closing Cards with description attribute
result = result.replace(
/<Card[\s\S]*?title="([^"]*)"[\s\S]*?href="([^"]*)"[\s\S]*?description="([^"]*)"[\s\S]*?\/>/g,
'- [$1]($2): $3'
);
+ // Cards with children content (non-self-closing)
+ result = result.replace(
+ /<Card[\s\S]*?title="([^"]*)"[\s\S]*?href="([^"]*)"[\s\S]*?>([\s\S]*?)<\/Card>/g,
+ '- [$1]($2): $3'
+ );
+ // Cards with href before title
+ result = result.replace(
+ /<Card[\s\S]*?href="([^"]*)"[\s\S]*?title="([^"]*)"[\s\S]*?>([\s\S]*?)<\/Card>/g,
+ '- [$2]($1): $3'
+ );
// Convert ProviderCard to markdown link
result = result.replace(