When reopening a todo list on app start, wrong items are shown
There is an issue when reopening a todo list upon app startup (the same might apply to other pages):
- The app first shows the expected list of child items.
- However, after a second it shows all todos in that library.
The behaviour could be due to the parentId is set too late on the ItemsModel. What most likely happens:
- The app starts a background query which basically will yield all todos in the library. Due to the size of the set of returned items, this query takes quite long to process.
- The item model is now updated. This starts a second query, which finishes way quicker.
- Now, the first query finishes and sends the results back to the GUI thread.
To fix this, we probably need to introduce a synchronisation mechanism:
- Ideally, upon changes, a client could cancel previously created queries.
- If results from an outdated query arrive, there shall be a way to recognise this and ignore these.