@@ -103,13 +103,16 @@ const Sidebar = ({
103
103
const { toast } = useToast ( ) ;
104
104
105
105
// Reusable error reporter for copy actions
106
- function reportError ( error : unknown ) {
107
- toast ( {
108
- title : "Error" ,
109
- description : `Failed to copy config: ${ error instanceof Error ? error . message : String ( error ) } ` ,
110
- variant : "destructive" ,
111
- } ) ;
112
- }
106
+ const reportError = useCallback (
107
+ ( error : unknown ) => {
108
+ toast ( {
109
+ title : "Error" ,
110
+ description : `Failed to copy config: ${ error instanceof Error ? error . message : String ( error ) } ` ,
111
+ variant : "destructive" ,
112
+ } ) ;
113
+ } ,
114
+ [ toast ] ,
115
+ ) ;
113
116
114
117
// Shared utility function to generate server config
115
118
const generateServerConfig = useCallback ( ( ) => {
@@ -182,7 +185,7 @@ const Sidebar = ({
182
185
} catch ( error ) {
183
186
reportError ( error ) ;
184
187
}
185
- } , [ generateMCPServerEntry , transportType , toast ] ) ;
188
+ } , [ generateMCPServerEntry , transportType , toast , reportError ] ) ;
186
189
187
190
const handleCopyServerFile = useCallback ( ( ) => {
188
191
try {
@@ -208,7 +211,7 @@ const Sidebar = ({
208
211
} catch ( error ) {
209
212
reportError ( error ) ;
210
213
}
211
- } , [ generateMCPServerFile , toast ] ) ;
214
+ } , [ generateMCPServerFile , toast , reportError ] ) ;
212
215
213
216
return (
214
217
< div className = "w-80 bg-card border-r border-border flex flex-col h-full" >
0 commit comments