diff --git a/src/pages/TelemetryView/ActiveMessagesOnline.jsx b/src/pages/TelemetryView/ActiveMessagesOnline.jsx
index 127f88d..ec888ea 100644
--- a/src/pages/TelemetryView/ActiveMessagesOnline.jsx
+++ b/src/pages/TelemetryView/ActiveMessagesOnline.jsx
@@ -1,5 +1,5 @@
import { Table } from 'antd'
-import { useState, useEffect } from 'react'
+import { useState, useEffect, useCallback, memo } from 'react'
import LoaderPortal from '@components/LoaderPortal'
import { invokeWebApiWrapperAsync } from '@components/factory'
@@ -10,14 +10,14 @@ import { columns } from '@pages/Messages'
import '@styles/message.css'
-export const ActiveMessagesOnline = ({ idWell }) => {
+export const ActiveMessagesOnline = memo(({ idWell }) => {
const [messages, setMessages] = useState([])
const [loader, setLoader] = useState(false)
- const handleReceiveMessages = (messages) => {
+ const handleReceiveMessages = useCallback((messages) => {
if (messages)
setMessages(messages.items.splice(0, 4))
- }
+ }, [])
useEffect(() => {
invokeWebApiWrapperAsync(
@@ -30,7 +30,7 @@ export const ActiveMessagesOnline = ({ idWell }) => {
'Получение списка сообщений'
)
return Subscribe('hubs/telemetry','ReceiveMessages', `well_${idWell}`, handleReceiveMessages)
- }, [idWell])
+ }, [idWell, handleReceiveMessages])
return (
@@ -46,6 +46,6 @@ export const ActiveMessagesOnline = ({ idWell }) => {
/>
)
-}
+})
export default ActiveMessagesOnline
diff --git a/src/pages/TelemetryView/ChartTimeOnlineFooter.jsx b/src/pages/TelemetryView/ChartTimeOnlineFooter.jsx
index 253a384..af7d928 100644
--- a/src/pages/TelemetryView/ChartTimeOnlineFooter.jsx
+++ b/src/pages/TelemetryView/ChartTimeOnlineFooter.jsx
@@ -1,9 +1,10 @@
+import { memo } from 'react'
import { Popover } from 'antd'
import { ControlOutlined } from '@ant-design/icons'
import { ValueDisplay } from '@components/Display'
-export const ChartTimeOnlineFooter = ({ data, lineGroup }) => {
+export const ChartTimeOnlineFooter = memo(({ data, lineGroup }) => {
const getFooterData = (name) => {
const dataIdx = data && lineGroup?.find(line => line?.footer === name)?.xAccessorName
return (
)
@@ -39,4 +40,6 @@ export const ChartTimeOnlineFooter = ({ data, lineGroup }) => {
)
-}
+})
+
+export default ChartTimeOnlineFooter
diff --git a/src/pages/TelemetryView/MonitoringColumn.jsx b/src/pages/TelemetryView/MonitoringColumn.jsx
index 9698527..01c7504 100644
--- a/src/pages/TelemetryView/MonitoringColumn.jsx
+++ b/src/pages/TelemetryView/MonitoringColumn.jsx
@@ -1,4 +1,4 @@
-import { useEffect, useState } from 'react'
+import { memo, useCallback, useEffect, useState } from 'react'
import { Grid, GridItem } from '@components/Grid'
import { makeDateSorter } from '@components/Table'
@@ -9,7 +9,7 @@ import { ChartTimeOnlineFooter } from './ChartTimeOnlineFooter'
const GetLimitShape = (flowChartData, points, accessor) => {
const min = [], max = []
- for (let point of points) {
+ for (const point of points) {
const program = flowChartData.find(v => v.depthStart < point.depth && point.depth < v.depthEnd)
if (!program) continue
@@ -29,7 +29,9 @@ const RemoveSimilar = (input, accessor) => {
return data
}
-export const MonitoringColumn = ({ lineGroup, data, flowChartData, interval, showBorder, style, headerHeight, pointCount = 2048, additionalLabels }) => {
+const addPointData = (point) => ({ depth: point.wellDepth })
+
+export const MonitoringColumn = memo(({ lineGroup, data, flowChartData, interval, showBorder, style, headerHeight, pointCount = 2048, additionalLabels }) => {
const [dataStore, setDataStore] = useState([])
const [lineGroupWithoutShapes, setLineGroupWithoutShapes] = useState([])
const dataLast = data?.[data.length - 1]
@@ -41,9 +43,7 @@ export const MonitoringColumn = ({ lineGroup, data, flowChartData, interval, sho
value: dataLast?.[line.xAccessorName]
}))
- const addPointData = (point) => ({ depth: point.wellDepth })
-
- const postParsing = (data) => {
+ const postParsing = useCallback((data) => {
lineGroupWithoutShapes.forEach(lineCfg => {
const lineDataSet = GetOrCreateDatasetByLineConfig(data.data, lineCfg)
@@ -54,7 +54,7 @@ export const MonitoringColumn = ({ lineGroup, data, flowChartData, interval, sho
})
}
})
- }
+ }, [lineGroupWithoutShapes, flowChartData, lineGroup])
useEffect(() => {
setDataStore(prevData => {
@@ -119,6 +119,6 @@ export const MonitoringColumn = ({ lineGroup, data, flowChartData, interval, sho