Make Chat show spinner until ready

Like EditAccount, instead of crashing if the room isn't loaded yet.
This commit is contained in:
miruka
2019-07-21 08:38:49 -04:00
parent 5b421f02d8
commit 246058e647
8 changed files with 178 additions and 115 deletions

View File

@@ -9,4 +9,24 @@ HListModel {
sorters: StringSorter {
roleName: "displayName"
}
readonly property ListModel _emptyModel: ListModel {}
function find(userId, category, roomId) {
if (! userId) { return }
let found = rooms.getWhere({userId, roomId, category}, 1)[0]
if (found) { return found }
return {
userId, category, roomId,
displayName: "",
avatarUrl: "",
topic: "",
members: _emptyModel,
typingText: "",
inviterId: "",
loading: true,
}
}
}

View File

@@ -11,8 +11,8 @@ HListModel {
// the expression with invalid data to establish property bindings
if (! userId) { return }
let found = getWhere({userId}, 1)
if (found.length > 0) { return found[0] }
let found = getWhere({userId}, 1)[0]
if (found) { return found }
py.callCoro("request_user_update_event", [userId])