Remove Chat user/roomInfo binding loop

This commit is contained in:
miruka 2020-03-08 04:02:26 -04:00
parent 46232e3fb1
commit 7d2b85dfda

View File

@ -11,11 +11,11 @@ Item {
onFocusChanged: if (focus && loader.item) loader.item.composer.takeFocus()
property string userId: ""
property string roomId: ""
property string userId
property string roomId
property QtObject userInfo: ModelStore.get("accounts").find(userId)
property QtObject roomInfo: ModelStore.get(userId, "rooms").find(roomId)
property QtObject userInfo: null
property QtObject roomInfo: null
property bool ready: Boolean(userInfo && roomInfo)
@ -23,6 +23,22 @@ Item {
readonly property alias roomPane: roomPaneLoader.item
Timer {
interval: 100
running: ! userInfo
repeat: true
triggeredOnStart: true
onTriggered: userInfo = ModelStore.get("accounts").find(userId)
}
Timer {
interval: 100
running: ! roomInfo
repeat: true
triggeredOnStart: true
onTriggered: roomInfo = ModelStore.get(userId, "rooms").find(roomId)
}
HLoader {
id: loader
anchors.rightMargin: ready ? roomPane.visibleSize : 0