Hide PyOtherSide error when EventList is destroyed

This commit is contained in:
miruka 2019-08-19 13:14:25 -04:00
parent 5e5a658173
commit 98803e8c23

View File

@ -72,11 +72,25 @@ HRectangle {
onYPosChanged: if (canLoad && yPos < 0.1) Qt.callLater(loadPastEvents)
function loadPastEvents() {
eventList.canLoad = false
py.callClientCoro(
chatPage.userId, "load_past_events", [chatPage.roomId],
moreToLoad => { eventList.canLoad = moreToLoad }
)
// try/catch blocks to hide pyotherside error when the
// component is destroyed but func is still running
try {
eventList.canLoad = false
py.callClientCoro(
chatPage.userId, "load_past_events", [chatPage.roomId],
moreToLoad => {
try {
eventList.canLoad = moreToLoad
} catch (err) {
return
}
}
)
} catch (err) {
return
}
}
property string inviter: chatPage.roomInfo.inviter || ""