Skip to content

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:

  1. 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.
  2. The item model is now updated. This starts a second query, which finishes way quicker.
  3. 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.
Edited by Martin Hoeher