Before optimization: - McpPanel.tsx: 298 lines (component + business logic) After optimization: - McpPanel.tsx: 234 lines (-21%, UI focused) - useMcpActions.ts: 137 lines (business logic) Benefits: ✅ Separation of concerns: UI vs business logic ✅ Reusability: MCP operations can be used in other components ✅ Testability: business logic can be tested independently ✅ Consistency: follows same pattern as useProviderActions ✅ Optimistic updates: toggle enabled status with rollback on error ✅ Unified error handling: all MCP errors use toast notifications Technical details: - Extract reload, toggleEnabled, saveServer, deleteServer - Implement optimistic UI updates for toggle - Centralize error handling and toast messages - Remove duplicate error handling code from component
7.0 KiB
7.0 KiB