Оптимизирована производительность React компонентов с помощью мемоизации
КРИТИЧНЫЕ КОМПОНЕНТЫ ОПТИМИЗИРОВАНЫ: • AdminDashboard (346 kB) - добавлены React.memo, useCallback, useMemo • SellerStatisticsDashboard (329 kB) - мемоизация кэша и callback функций • CreateSupplyPage (276 kB) - оптимизированы вычисления и обработчики • EmployeesDashboard (268 kB) - мемоизация списков и функций • SalesTab + AdvertisingTab - React.memo обертка ТЕХНИЧЕСКИЕ УЛУЧШЕНИЯ: ✅ React.memo() для предотвращения лишних рендеров ✅ useMemo() для тяжелых вычислений ✅ useCallback() для стабильных ссылок на функции ✅ Мемоизация фильтрации и сортировки списков ✅ Оптимизация пропсов в компонентах-контейнерах РЕЗУЛЬТАТЫ: • Все компоненты успешно компилируются • Линтер проходит без критических ошибок • Сохранена вся функциональность • Улучшена производительность рендеринга • Снижена нагрузка на React дерево 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -1,11 +1,13 @@
|
||||
"use client"
|
||||
'use client'
|
||||
|
||||
import { useAuth } from '@/hooks/useAuth'
|
||||
import { Card } from '@/components/ui/card'
|
||||
import { Building2, Phone } from 'lucide-react'
|
||||
import { Sidebar } from './sidebar'
|
||||
|
||||
import { Card } from '@/components/ui/card'
|
||||
import { useAuth } from '@/hooks/useAuth'
|
||||
import { useSidebar } from '@/hooks/useSidebar'
|
||||
|
||||
import { Sidebar } from './sidebar'
|
||||
|
||||
export function DashboardHome() {
|
||||
const { user } = useAuth()
|
||||
const { getSidebarMargin } = useSidebar()
|
||||
@ -20,8 +22,6 @@ export function DashboardHome() {
|
||||
return 'Вашей организации'
|
||||
}
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div className="h-screen flex overflow-hidden">
|
||||
<Sidebar />
|
||||
@ -35,14 +35,8 @@ export function DashboardHome() {
|
||||
<h3 className="text-xl font-semibold text-white">Организация</h3>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<p className="text-white font-medium">
|
||||
{getOrganizationName()}
|
||||
</p>
|
||||
{user?.organization?.inn && (
|
||||
<p className="text-white/60 text-sm">
|
||||
ИНН: {user.organization.inn}
|
||||
</p>
|
||||
)}
|
||||
<p className="text-white font-medium">{getOrganizationName()}</p>
|
||||
{user?.organization?.inn && <p className="text-white/60 text-sm">ИНН: {user.organization.inn}</p>}
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
@ -53,12 +47,8 @@ export function DashboardHome() {
|
||||
<h3 className="text-xl font-semibold text-white">Контакты</h3>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<p className="text-white font-medium">
|
||||
+{user?.phone}
|
||||
</p>
|
||||
<p className="text-white/60 text-sm">
|
||||
Основной номер
|
||||
</p>
|
||||
<p className="text-white font-medium">+{user?.phone}</p>
|
||||
<p className="text-white/60 text-sm">Основной номер</p>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
@ -71,12 +61,8 @@ export function DashboardHome() {
|
||||
<h3 className="text-xl font-semibold text-white">SferaV</h3>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<p className="text-white font-medium">
|
||||
Система управления бизнесом
|
||||
</p>
|
||||
<p className="text-white/60 text-sm">
|
||||
Версия 1.0
|
||||
</p>
|
||||
<p className="text-white font-medium">Система управления бизнесом</p>
|
||||
<p className="text-white/60 text-sm">Версия 1.0</p>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
@ -84,4 +70,4 @@ export function DashboardHome() {
|
||||
</main>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user