Skip to content

Thought Cache & Iterative Loading#703

Merged
raineorshine merged 220 commits intodevfrom
staged-loading
Nov 10, 2020
Merged

Thought Cache & Iterative Loading#703
raineorshine merged 220 commits intodevfrom
staged-loading

Conversation

@raineorshine
Copy link
Contributor

@raineorshine raineorshine commented May 27, 2020

Syncing with IndexedDB and Firebase is now handled mainly through two pieces of middleware:

  • pushQueue (formerly syncQueue)
  • pullQueue

The pushQueue is triggered and throttled whenever state.thoughts is changed. This is unchanged from dev.

The pullQueue (what I originally called thoughtCache) is entirely new. It is triggered and throttled on every action, monitoring changes to visible thoughts. Whenever the visible thoughts change (e.g. when the cursor changes), visible thoughts and their children are queued up to be fetched from IndexedDB and Firebase. They are fetched asynchronously, one level at a time, then reconciled and merged with state.thoughts.

The Parent type has a new property: pending. This indicates that it has descendants that have not yet been pulled. When pending thoughts are made visible, they will be immediately added to the pull queue, triggering a fetch from the server. As we optimize this, we should be able to pull thoughts in the background as the user navigates, so that they rarely see a pending thought.

Fixes #273.

@raineorshine raineorshine force-pushed the staged-loading branch 3 times, most recently from 5273a64 to 5307a9f Compare May 28, 2020 13:37
@raineorshine raineorshine force-pushed the staged-loading branch 2 times, most recently from 092fdd9 to 3b5e9e4 Compare June 7, 2020 17:15
@raineorshine raineorshine changed the base branch from dev to contextindex-object June 7, 2020 17:17
@raineorshine raineorshine changed the base branch from contextindex-object to dev June 7, 2020 17:17
@raineorshine raineorshine force-pushed the staged-loading branch 9 times, most recently from 8e67827 to f1f7112 Compare June 10, 2020 22:47
@raineorshine raineorshine changed the title Staged local loading Thought Cache Middleware & Iterative Loading Jun 10, 2020
@raineorshine raineorshine changed the title Thought Cache Middleware & Iterative Loading Thought Cache & Iterative Loading Jun 10, 2020
@raineorshine raineorshine force-pushed the staged-loading branch 7 times, most recently from ada7576 to 88ede1e Compare June 18, 2020 19:11
@raineorshine raineorshine force-pushed the staged-loading branch 3 times, most recently from 5ddbca2 to cea28a3 Compare June 21, 2020 21:26
@raineorshine raineorshine merged commit 7ef14b2 into dev Nov 10, 2020
@raineorshine raineorshine deleted the staged-loading branch November 10, 2020 02:03
anmolarora1 pushed a commit to anmolarora1/em that referenced this pull request Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Staged local loading

3 participants