Оптимизирована производительность 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:
Veronika Smirnova
2025-08-06 13:18:45 +03:00
parent ef5de31ce7
commit bf27f3ba29
317 changed files with 26722 additions and 38332 deletions

View File

@ -1,4 +1,4 @@
import { gql } from "graphql-tag";
import { gql } from 'graphql-tag'
export const SEND_SMS_CODE = gql`
mutation SendSmsCode($phone: String!) {
@ -7,7 +7,7 @@ export const SEND_SMS_CODE = gql`
message
}
}
`;
`
export const VERIFY_SMS_CODE = gql`
mutation VerifySmsCode($phone: String!, $code: String!) {
@ -56,7 +56,7 @@ export const VERIFY_SMS_CODE = gql`
}
}
}
`;
`
export const VERIFY_INN = gql`
mutation VerifyInn($inn: String!) {
@ -71,12 +71,10 @@ export const VERIFY_INN = gql`
}
}
}
`;
`
export const REGISTER_FULFILLMENT_ORGANIZATION = gql`
mutation RegisterFulfillmentOrganization(
$input: FulfillmentRegistrationInput!
) {
mutation RegisterFulfillmentOrganization($input: FulfillmentRegistrationInput!) {
registerFulfillmentOrganization(input: $input) {
success
message
@ -121,7 +119,7 @@ export const REGISTER_FULFILLMENT_ORGANIZATION = gql`
}
}
}
`;
`
export const REGISTER_SELLER_ORGANIZATION = gql`
mutation RegisterSellerOrganization($input: SellerRegistrationInput!) {
@ -169,7 +167,7 @@ export const REGISTER_SELLER_ORGANIZATION = gql`
}
}
}
`;
`
export const ADD_MARKETPLACE_API_KEY = gql`
mutation AddMarketplaceApiKey($input: MarketplaceApiKeyInput!) {
@ -185,13 +183,13 @@ export const ADD_MARKETPLACE_API_KEY = gql`
}
}
}
`;
`
export const REMOVE_MARKETPLACE_API_KEY = gql`
mutation RemoveMarketplaceApiKey($marketplace: MarketplaceType!) {
removeMarketplaceApiKey(marketplace: $marketplace)
}
`;
`
export const UPDATE_USER_PROFILE = gql`
mutation UpdateUserProfile($input: UpdateUserProfileInput!) {
@ -241,7 +239,7 @@ export const UPDATE_USER_PROFILE = gql`
}
}
}
`;
`
export const UPDATE_ORGANIZATION_BY_INN = gql`
mutation UpdateOrganizationByInn($inn: String!) {
@ -289,15 +287,12 @@ export const UPDATE_ORGANIZATION_BY_INN = gql`
}
}
}
`;
`
// Мутации для контрагентов
export const SEND_COUNTERPARTY_REQUEST = gql`
mutation SendCounterpartyRequest($organizationId: ID!, $message: String) {
sendCounterpartyRequest(
organizationId: $organizationId
message: $message
) {
sendCounterpartyRequest(organizationId: $organizationId, message: $message) {
success
message
request {
@ -322,7 +317,7 @@ export const SEND_COUNTERPARTY_REQUEST = gql`
}
}
}
`;
`
export const RESPOND_TO_COUNTERPARTY_REQUEST = gql`
mutation RespondToCounterpartyRequest($requestId: ID!, $accept: Boolean!) {
@ -351,32 +346,24 @@ export const RESPOND_TO_COUNTERPARTY_REQUEST = gql`
}
}
}
`;
`
export const CANCEL_COUNTERPARTY_REQUEST = gql`
mutation CancelCounterpartyRequest($requestId: ID!) {
cancelCounterpartyRequest(requestId: $requestId)
}
`;
`
export const REMOVE_COUNTERPARTY = gql`
mutation RemoveCounterparty($organizationId: ID!) {
removeCounterparty(organizationId: $organizationId)
}
`;
`
// Мутации для сообщений
export const SEND_MESSAGE = gql`
mutation SendMessage(
$receiverOrganizationId: ID!
$content: String!
$type: MessageType = TEXT
) {
sendMessage(
receiverOrganizationId: $receiverOrganizationId
content: $content
type: $type
) {
mutation SendMessage($receiverOrganizationId: ID!, $content: String!, $type: MessageType = TEXT) {
sendMessage(receiverOrganizationId: $receiverOrganizationId, content: $content, type: $type) {
success
message
messageData {
@ -418,14 +405,10 @@ export const SEND_MESSAGE = gql`
}
}
}
`;
`
export const SEND_VOICE_MESSAGE = gql`
mutation SendVoiceMessage(
$receiverOrganizationId: ID!
$voiceUrl: String!
$voiceDuration: Int!
) {
mutation SendVoiceMessage($receiverOrganizationId: ID!, $voiceUrl: String!, $voiceDuration: Int!) {
sendVoiceMessage(
receiverOrganizationId: $receiverOrganizationId
voiceUrl: $voiceUrl
@ -472,7 +455,7 @@ export const SEND_VOICE_MESSAGE = gql`
}
}
}
`;
`
export const SEND_IMAGE_MESSAGE = gql`
mutation SendImageMessage(
@ -530,7 +513,7 @@ export const SEND_IMAGE_MESSAGE = gql`
}
}
}
`;
`
export const SEND_FILE_MESSAGE = gql`
mutation SendFileMessage(
@ -588,13 +571,13 @@ export const SEND_FILE_MESSAGE = gql`
}
}
}
`;
`
export const MARK_MESSAGES_AS_READ = gql`
mutation MarkMessagesAsRead($conversationId: ID!) {
markMessagesAsRead(conversationId: $conversationId)
}
`;
`
// Мутации для услуг
export const CREATE_SERVICE = gql`
@ -613,7 +596,7 @@ export const CREATE_SERVICE = gql`
}
}
}
`;
`
export const UPDATE_SERVICE = gql`
mutation UpdateService($id: ID!, $input: ServiceInput!) {
@ -631,13 +614,13 @@ export const UPDATE_SERVICE = gql`
}
}
}
`;
`
export const DELETE_SERVICE = gql`
mutation DeleteService($id: ID!) {
deleteService(id: $id)
}
`;
`
// Мутации для расходников
export const CREATE_SUPPLY = gql`
@ -664,7 +647,7 @@ export const CREATE_SUPPLY = gql`
}
}
}
`;
`
export const UPDATE_SUPPLY = gql`
mutation UpdateSupply($id: ID!, $input: SupplyInput!) {
@ -690,13 +673,13 @@ export const UPDATE_SUPPLY = gql`
}
}
}
`;
`
export const DELETE_SUPPLY = gql`
mutation DeleteSupply($id: ID!) {
deleteSupply(id: $id)
}
`;
`
// Мутация для заказа поставки расходников
export const CREATE_SUPPLY_ORDER = gql`
@ -744,15 +727,11 @@ export const CREATE_SUPPLY_ORDER = gql`
}
}
}
`;
`
// Мутация для назначения логистики на поставку фулфилментом
export const ASSIGN_LOGISTICS_TO_SUPPLY = gql`
mutation AssignLogisticsToSupply(
$supplyOrderId: ID!
$logisticsPartnerId: ID!
$responsibleId: ID
) {
mutation AssignLogisticsToSupply($supplyOrderId: ID!, $logisticsPartnerId: ID!, $responsibleId: ID) {
assignLogisticsToSupply(
supplyOrderId: $supplyOrderId
logisticsPartnerId: $logisticsPartnerId
@ -780,7 +759,7 @@ export const ASSIGN_LOGISTICS_TO_SUPPLY = gql`
}
}
}
`;
`
// Мутации для логистики
export const CREATE_LOGISTICS = gql`
@ -800,7 +779,7 @@ export const CREATE_LOGISTICS = gql`
}
}
}
`;
`
export const UPDATE_LOGISTICS = gql`
mutation UpdateLogistics($id: ID!, $input: LogisticsInput!) {
@ -819,13 +798,13 @@ export const UPDATE_LOGISTICS = gql`
}
}
}
`;
`
export const DELETE_LOGISTICS = gql`
mutation DeleteLogistics($id: ID!) {
deleteLogistics(id: $id)
}
`;
`
// Мутации для товаров поставщика
export const CREATE_PRODUCT = gql`
@ -865,7 +844,7 @@ export const CREATE_PRODUCT = gql`
}
}
}
`;
`
export const UPDATE_PRODUCT = gql`
mutation UpdateProduct($id: ID!, $input: ProductInput!) {
@ -904,13 +883,13 @@ export const UPDATE_PRODUCT = gql`
}
}
}
`;
`
export const DELETE_PRODUCT = gql`
mutation DeleteProduct($id: ID!) {
deleteProduct(id: $id)
}
`;
`
// Мутация для проверки уникальности артикула
export const CHECK_ARTICLE_UNIQUENESS = gql`
@ -924,7 +903,7 @@ export const CHECK_ARTICLE_UNIQUENESS = gql`
}
}
}
`;
`
// Мутация для резервирования товара (при заказе)
export const RESERVE_PRODUCT_STOCK = gql`
@ -940,7 +919,7 @@ export const RESERVE_PRODUCT_STOCK = gql`
}
}
}
`;
`
// Мутация для освобождения резерва (при отмене заказа)
export const RELEASE_PRODUCT_RESERVE = gql`
@ -956,20 +935,12 @@ export const RELEASE_PRODUCT_RESERVE = gql`
}
}
}
`;
`
// Мутация для обновления статуса "в пути"
export const UPDATE_PRODUCT_IN_TRANSIT = gql`
mutation UpdateProductInTransit(
$productId: ID!
$quantity: Int!
$operation: String!
) {
updateProductInTransit(
productId: $productId
quantity: $quantity
operation: $operation
) {
mutation UpdateProductInTransit($productId: ID!, $quantity: Int!, $operation: String!) {
updateProductInTransit(productId: $productId, quantity: $quantity, operation: $operation) {
success
message
product {
@ -981,7 +952,7 @@ export const UPDATE_PRODUCT_IN_TRANSIT = gql`
}
}
}
`;
`
// Мутации для корзины
export const ADD_TO_CART = gql`
@ -1017,7 +988,7 @@ export const ADD_TO_CART = gql`
}
}
}
`;
`
export const UPDATE_CART_ITEM = gql`
mutation UpdateCartItem($productId: ID!, $quantity: Int!) {
@ -1052,7 +1023,7 @@ export const UPDATE_CART_ITEM = gql`
}
}
}
`;
`
export const REMOVE_FROM_CART = gql`
mutation RemoveFromCart($productId: ID!) {
@ -1087,13 +1058,13 @@ export const REMOVE_FROM_CART = gql`
}
}
}
`;
`
export const CLEAR_CART = gql`
mutation ClearCart {
clearCart
}
`;
`
// Мутации для избранного
export const ADD_TO_FAVORITES = gql`
@ -1122,7 +1093,7 @@ export const ADD_TO_FAVORITES = gql`
}
}
}
`;
`
export const REMOVE_FROM_FAVORITES = gql`
mutation RemoveFromFavorites($productId: ID!) {
@ -1150,7 +1121,7 @@ export const REMOVE_FROM_FAVORITES = gql`
}
}
}
`;
`
// Мутации для внешней рекламы
export const CREATE_EXTERNAL_AD = gql`
@ -1172,7 +1143,7 @@ export const CREATE_EXTERNAL_AD = gql`
}
}
}
`;
`
export const UPDATE_EXTERNAL_AD = gql`
mutation UpdateExternalAd($id: ID!, $input: ExternalAdInput!) {
@ -1193,7 +1164,7 @@ export const UPDATE_EXTERNAL_AD = gql`
}
}
}
`;
`
export const DELETE_EXTERNAL_AD = gql`
mutation DeleteExternalAd($id: ID!) {
@ -1205,7 +1176,7 @@ export const DELETE_EXTERNAL_AD = gql`
}
}
}
`;
`
export const UPDATE_EXTERNAL_AD_CLICKS = gql`
mutation UpdateExternalAdClicks($id: ID!, $clicks: Int!) {
@ -1214,7 +1185,7 @@ export const UPDATE_EXTERNAL_AD_CLICKS = gql`
message
}
}
`;
`
// Мутации для категорий
export const CREATE_CATEGORY = gql`
@ -1230,7 +1201,7 @@ export const CREATE_CATEGORY = gql`
}
}
}
`;
`
export const UPDATE_CATEGORY = gql`
mutation UpdateCategory($id: ID!, $input: CategoryInput!) {
@ -1245,13 +1216,13 @@ export const UPDATE_CATEGORY = gql`
}
}
}
`;
`
export const DELETE_CATEGORY = gql`
mutation DeleteCategory($id: ID!) {
deleteCategory(id: $id)
}
`;
`
// Мутации для сотрудников
export const CREATE_EMPLOYEE = gql`
@ -1280,7 +1251,7 @@ export const CREATE_EMPLOYEE = gql`
}
}
}
`;
`
export const UPDATE_EMPLOYEE = gql`
mutation UpdateEmployee($id: ID!, $input: UpdateEmployeeInput!) {
@ -1313,19 +1284,19 @@ export const UPDATE_EMPLOYEE = gql`
}
}
}
`;
`
export const DELETE_EMPLOYEE = gql`
mutation DeleteEmployee($id: ID!) {
deleteEmployee(id: $id)
}
`;
`
export const UPDATE_EMPLOYEE_SCHEDULE = gql`
mutation UpdateEmployeeSchedule($input: UpdateScheduleInput!) {
updateEmployeeSchedule(input: $input)
}
`;
`
export const CREATE_WILDBERRIES_SUPPLY = gql`
mutation CreateWildberriesSupply($input: CreateWildberriesSupplyInput!) {
@ -1342,7 +1313,7 @@ export const CREATE_WILDBERRIES_SUPPLY = gql`
}
}
}
`;
`
// Админ мутации
export const ADMIN_LOGIN = gql`
@ -1362,13 +1333,13 @@ export const ADMIN_LOGIN = gql`
}
}
}
`;
`
export const ADMIN_LOGOUT = gql`
mutation AdminLogout {
adminLogout
}
`;
`
export const CREATE_SUPPLY_SUPPLIER = gql`
mutation CreateSupplySupplier($input: CreateSupplySupplierInput!) {
@ -1388,7 +1359,7 @@ export const CREATE_SUPPLY_SUPPLIER = gql`
}
}
}
`;
`
// Мутация для обновления статуса заказа поставки
export const UPDATE_SUPPLY_ORDER_STATUS = gql`
@ -1430,7 +1401,7 @@ export const UPDATE_SUPPLY_ORDER_STATUS = gql`
}
}
}
`;
`
// Мутации для кеша склада WB
export const SAVE_WB_WAREHOUSE_CACHE = gql`
@ -1452,7 +1423,7 @@ export const SAVE_WB_WAREHOUSE_CACHE = gql`
}
}
}
`;
`
// Мутации для кеша статистики продаж
export const SAVE_SELLER_STATS_CACHE = gql`
@ -1481,7 +1452,7 @@ export const SAVE_SELLER_STATS_CACHE = gql`
}
}
}
`;
`
// Новые мутации для управления заказами поставок
export const SUPPLIER_APPROVE_ORDER = gql`
@ -1508,7 +1479,7 @@ export const SUPPLIER_APPROVE_ORDER = gql`
}
}
}
`;
`
export const SUPPLIER_REJECT_ORDER = gql`
mutation SupplierRejectOrder($id: ID!, $reason: String) {
@ -1521,7 +1492,7 @@ export const SUPPLIER_REJECT_ORDER = gql`
}
}
}
`;
`
export const SUPPLIER_SHIP_ORDER = gql`
mutation SupplierShipOrder($id: ID!) {
@ -1545,7 +1516,7 @@ export const SUPPLIER_SHIP_ORDER = gql`
}
}
}
`;
`
export const LOGISTICS_CONFIRM_ORDER = gql`
mutation LogisticsConfirmOrder($id: ID!) {
@ -1569,7 +1540,7 @@ export const LOGISTICS_CONFIRM_ORDER = gql`
}
}
}
`;
`
export const LOGISTICS_REJECT_ORDER = gql`
mutation LogisticsRejectOrder($id: ID!, $reason: String) {
@ -1582,7 +1553,7 @@ export const LOGISTICS_REJECT_ORDER = gql`
}
}
}
`;
`
export const FULFILLMENT_RECEIVE_ORDER = gql`
mutation FulfillmentReceiveOrder($id: ID!) {
@ -1608,4 +1579,4 @@ export const FULFILLMENT_RECEIVE_ORDER = gql`
}
}
}
`;
`