setLoader(false) перенесён в вызов у промиса для ActiveMessage и TelemetryView

This commit is contained in:
Alexey 2021-07-29 15:46:59 +05:00
parent e350c4e4cd
commit c5abb21e6d
2 changed files with 8 additions and 15 deletions

View File

@ -54,18 +54,15 @@ export default function ActiveMessagesOnline({idWell}) {
useEffect(() => {
setLoader(true)
let promiseMessages = MessageService.getMessage(idWell)
MessageService.getMessage(idWell)
.then(handleReceiveMessages)
.catch((ex) => {
notify(`Не удалось загрузить сообщения по скважине "${idWell}"`, 'error')
console.log(ex)
})
.finally(()=>setLoader(false))
Promise.all([promiseMessages]).then(()=>setLoader(false))
let unSubscribeMessagesHub = Subscribe('hubs/telemetry','ReceiveMessages', `well_${idWell}`, handleReceiveMessages)
return () => {
unSubscribeMessagesHub()
}
return Subscribe('hubs/telemetry','ReceiveMessages', `well_${idWell}`, handleReceiveMessages)
}, [idWell])
return (<LoaderPortal show={loader}>

View File

@ -142,20 +142,16 @@ export default function TelemetryView(props) {
useEffect(() => {
setLoader(true)
let promiseData = DataService.getData(id)
DataService.getData(id)
.then(handleReceiveDataSaub)
.catch((ex) => {
notify(`Не удалось загрузить данные по скважине "${id}"`, 'error')
console.log(ex)
})
.finally(()=>setLoader(false))
Promise.all([promiseData]).then(()=>setLoader(false))
let unSubscribeDataSaubHub = Subscribe('hubs/telemetry', 'ReceiveDataSaub', `well_${id}`, handleReceiveDataSaub)
return () => {
unSubscribeDataSaubHub()
}
}, [id]);
return Subscribe('hubs/telemetry', 'ReceiveDataSaub', `well_${id}`, handleReceiveDataSaub)
}, [id])
useEffect(() => {
setLoader(true)
@ -163,7 +159,7 @@ export default function TelemetryView(props) {
.then(handleReceiveDataSaub)
.catch(error => console.error(error))
.finally(()=>setLoader(false))
}, [id, chartInterval]);
}, [id, chartInterval])
const colSpan = 24 / (paramsGroups.length)