Work around ModelStore binding loop
This commit is contained in:
parent
b30ce33494
commit
5ae71cb7ce
1
TODO.md
1
TODO.md
|
@ -8,7 +8,6 @@
|
|||
- fix: on startup, if a room's last event is a membership change,
|
||||
it won't be visible in timeline no matter what the user config is
|
||||
- fix: there are rooms without messages on first sync
|
||||
- fix binding loops?
|
||||
|
||||
- update docstrings
|
||||
- update flatpak nio required version
|
||||
|
|
|
@ -6,6 +6,11 @@ import "PythonBridge"
|
|||
|
||||
QtObject {
|
||||
property QtObject privates: QtObject {
|
||||
onEnsureModelExists:
|
||||
py.callCoro("models.ensure_exists_from_qml", [modelId])
|
||||
|
||||
signal ensureModelExists(var modelId)
|
||||
|
||||
readonly property var store: ({})
|
||||
|
||||
readonly property PythonBridge py: PythonBridge {}
|
||||
|
@ -39,7 +44,8 @@ QtObject {
|
|||
if (modelId.length === 1) modelId = modelId[0]
|
||||
|
||||
if (! privates.store[modelId]) {
|
||||
privates.py.callCoro("models.ensure_exists_from_qml", [modelId])
|
||||
// Using a signal somehow avoids a binding loop
|
||||
privates.ensureModelExists(modelId)
|
||||
|
||||
privates.store[modelId] =
|
||||
privates.model.createObject(this, {modelId})
|
||||
|
|
|
@ -26,6 +26,7 @@ Python {
|
|||
|
||||
Globals.pendingCoroutines[uuid] = {future, onSuccess, onError}
|
||||
Globals.pendingCoroutinesChanged()
|
||||
// if (name === "models.ensure_exists_from_qml") { print("r"); return}
|
||||
|
||||
call("BRIDGE.call_backend_coro", [name, uuid, args], pyFuture => {
|
||||
future.privates.pythonFuture = pyFuture
|
||||
|
|
Loading…
Reference in New Issue
Block a user