perf: Fix all 7 code analysis issues
HIGH (Performance):
- Replace 8 sync file operations with aiofiles in async context (storage, mail,
report_generator, dms_bridge, ai_assistant)
- Frontend bundle splitting: manualChunks for react-vendor, ui-components, tanstack,
markdown, icons, utils, i18n (ui chunk 936K → ~19K)
MEDIUM (Architecture):
- Worker circular deps: Replace direct plugin imports with job_registry.py pattern
(register_job/get_all_jobs, importlib-based lazy loading)
- App-wide ErrorBoundary: New ErrorBoundary.tsx component, wrapped in AppShell
and all standalone routes
LOW (Code Quality):
- N+1 query fix: selectinload(Contact.contact_persons) in list_contacts()
- O(n²) dedup fix: SQL GROUP BY for email/phone duplicates, Dict-based name grouping
- Response format standardization: 7 routes converted from plain arrays to
{items: [...], total: N} format
This commit is contained in:
@@ -7,6 +7,7 @@ import { PasswordResetRequestPage } from '@/pages/PasswordResetRequest';
|
||||
import { PasswordResetConfirmPage } from '@/pages/PasswordResetConfirm';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { PluginRouteRenderer } from '@/components/plugins/PluginRouteRenderer';
|
||||
import { ErrorBoundary } from '@/components/ErrorBoundary';
|
||||
|
||||
// Lazy-loaded pages (code-splitting)
|
||||
const DashboardPage = React.lazy(() => import('@/pages/Dashboard').then(m => ({ default: m.DashboardPage })));
|
||||
@@ -73,23 +74,23 @@ const router = createBrowserRouter([
|
||||
},
|
||||
{
|
||||
path: '/ai-assistant-standalone',
|
||||
element: withSuspense(<AIAssistantStandalonePage />),
|
||||
element: <ErrorBoundary>{withSuspense(<AIAssistantStandalonePage />)}</ErrorBoundary>,
|
||||
},
|
||||
{
|
||||
path: '/dms-standalone',
|
||||
element: withSuspense(<DmsStandalonePage />),
|
||||
element: <ErrorBoundary>{withSuspense(<DmsStandalonePage />)}</ErrorBoundary>,
|
||||
},
|
||||
{
|
||||
path: '/calendar-standalone',
|
||||
element: withSuspense(<CalendarStandalonePage />),
|
||||
element: <ErrorBoundary>{withSuspense(<CalendarStandalonePage />)}</ErrorBoundary>,
|
||||
},
|
||||
{
|
||||
path: '/mail-standalone',
|
||||
element: withSuspense(<MailStandalonePage />),
|
||||
element: <ErrorBoundary>{withSuspense(<MailStandalonePage />)}</ErrorBoundary>,
|
||||
},
|
||||
{
|
||||
path: '/contacts-standalone',
|
||||
element: withSuspense(<ContactsStandalonePage />),
|
||||
element: <ErrorBoundary>{withSuspense(<ContactsStandalonePage />)}</ErrorBoundary>,
|
||||
},
|
||||
{
|
||||
path: '/password-reset',
|
||||
|
||||
Reference in New Issue
Block a user