Доработано очищение графика телеметрии

This commit is contained in:
goodmice 2022-11-07 06:33:14 +05:00
parent 9c85b1e229
commit f82b80d0d0
No known key found for this signature in database
GPG Key ID: 63EA771203189CF1

View File

@ -157,14 +157,14 @@ const TelemetryView = memo(() => {
const spinSubject$ = useMemo(() => new BehaviorSubject(), []) const spinSubject$ = useMemo(() => new BehaviorSubject(), [])
const handleDataSaub = useCallback((data, replace = false) => { const handleDataSaub = useCallback((data, replace = false) => {
if (data) { setDataSaub((prev) => {
if (!data)
return replace ? [] : prev
const dataSaub = normalizeData(data) const dataSaub = normalizeData(data)
setDataSaub((prev) => { const out = replace ? [...dataSaub] : [...prev, ...dataSaub]
const out = replace ? [...dataSaub] : [...prev, ...dataSaub] out.sort(dateSorter)
out.sort(dateSorter) return out
return out })
})
}
}, []) }, [])
const handleDataSpin = useCallback((data) => data && setDataSpin((prev) => [...prev, ...data]), []) const handleDataSpin = useCallback((data) => data && setDataSpin((prev) => [...prev, ...data]), [])