From d40140c2e896716709f51c075bdeeb6c14216fff Mon Sep 17 00:00:00 2001 From: sumeetpardeshi Date: Wed, 14 May 2025 19:01:22 -0700 Subject: [PATCH] fixing lint error --- client/src/components/Sidebar.tsx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/client/src/components/Sidebar.tsx b/client/src/components/Sidebar.tsx index 40b0431..a7668d4 100644 --- a/client/src/components/Sidebar.tsx +++ b/client/src/components/Sidebar.tsx @@ -103,13 +103,16 @@ const Sidebar = ({ const { toast } = useToast(); // Reusable error reporter for copy actions - function reportError(error: unknown) { - toast({ - title: "Error", - description: `Failed to copy config: ${error instanceof Error ? error.message : String(error)}`, - variant: "destructive", - }); - } + const reportError = useCallback( + (error: unknown) => { + toast({ + title: "Error", + description: `Failed to copy config: ${error instanceof Error ? error.message : String(error)}`, + variant: "destructive", + }); + }, + [toast], + ); // Shared utility function to generate server config const generateServerConfig = useCallback(() => { @@ -182,7 +185,7 @@ const Sidebar = ({ } catch (error) { reportError(error); } - }, [generateMCPServerEntry, transportType, toast]); + }, [generateMCPServerEntry, transportType, toast, reportError]); const handleCopyServerFile = useCallback(() => { try { @@ -208,7 +211,7 @@ const Sidebar = ({ } catch (error) { reportError(error); } - }, [generateMCPServerFile, toast]); + }, [generateMCPServerFile, toast, reportError]); return (