Skip to content

Staged local loading #273

@raineorshine

Description

@raineorshine

Large amounts of data (5,000+ thoughts) causes the app to load very slowly from IndexedDB. Instead of loading the data all at once (loadLocalState), load the data and render in stages only the thoughts that are within a few steps from the cursor. The thoughtIndex and contextIndex will then serve as a cache of thoughts rather than a complete index.

Thoughts should be loaded in two stages. The first stage is the most critical as it is the "time-till-first-load" that most affects the user's perception of the loading time.

  1. Load expanded thoughts and their children.
  2. Load children, grandchildren, and great grandchildren.

After the initial load, thoughts should be swapped out as follows:

  • When the cursor moves, recalculate expanded and load thoughts as described above for the new cursor.
  • Show “Loading...” in place of children that are still loading (also on startup).
  • Delete least recently accessed thoughts when they exceed a configurable cache size.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions