Cache data in browser storage, and load from local cache when present #189

Merged
raucao merged 8 commits from feature/data_loading into master 2020-05-31 08:44:37 +00:00
raucao commented 2020-05-27 15:35:23 +00:00 (Migrated from github.com)

With this change, all data will be stored in your local IndexedDB after fetching it. Then, when present on app launch, it will be loaded from the cache, instead of the network. After the loading screen has finished, the app will then fetch updated data from the network.

Aside from the obvious speedups for users who visit more than once, there's also one considerable performance optimization baked into this PR for completely new users: it will only fetch the last 30 contributions from the network when loading the app for the first time, and then fetch the last 200 after rendering the page (and add them to the list when done).

closes #182

With this change, all data will be stored in your local IndexedDB after fetching it. Then, when present on app launch, it will be loaded from the cache, instead of the network. After the loading screen has finished, the app will then fetch updated data from the network. Aside from the obvious speedups for users who visit more than once, there's also one considerable performance optimization baked into this PR for completely new users: it will only fetch the last 30 contributions from the network when loading the app for the first time, and then fetch the last 200 after rendering the page (and add them to the list when done). closes #182
fsmanuel (Migrated from github.com) reviewed 2020-05-27 15:35:23 +00:00
bumi (Migrated from github.com) approved these changes 2020-05-30 10:46:00 +00:00
bumi (Migrated from github.com) left a comment

I've tested the app. looks great for me here! 👍

I've tested the app. looks great for me here! :+1:
@@ -0,0 +2,4 @@
const processed = {}
if (data.confirmedAtBlock && (typeof data.confirmedAtBlock.toNumber === 'function')) {
processed.confirmedAt = data.confirmedAtBlock.toNumber();
bumi (Migrated from github.com) commented 2020-05-30 10:35:09 +00:00

was wondering if the rename from confirmedAtBlock to confirmedAt is so needed because now we call it differently in the kredits-contracts and kredits-web

was wondering if the rename from `confirmedAtBlock` to `confirmedAt` is so needed because now we call it differently in the kredits-contracts and kredits-web
galfert (Migrated from github.com) approved these changes 2020-05-30 14:20:32 +00:00
galfert (Migrated from github.com) left a comment

Code looks ok to me. Haven't tested it myself.

Code looks ok to me. Haven't tested it myself.
raucao (Migrated from github.com) reviewed 2020-05-31 08:44:07 +00:00
@@ -0,0 +2,4 @@
const processed = {}
if (data.confirmedAtBlock && (typeof data.confirmedAtBlock.toNumber === 'function')) {
processed.confirmedAt = data.confirmedAtBlock.toNumber();
raucao (Migrated from github.com) commented 2020-05-31 08:44:07 +00:00

It's not a rename, because it's the same property that returned the number before as well. The confirmedAtBlock is the one from the contracts, which isn't formatted as a number.

It's not a rename, because it's the same property that returned the number before as well. The `confirmedAtBlock` is the one from the contracts, which isn't formatted as a number.
Sign in to join this conversation.