Cache data in browser storage, and load from local cache when present #189
Reference in New Issue
Block a user
Delete Branch "feature/data_loading"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
I've tested the app. looks great for me here! 👍
@@ -0,0 +2,4 @@const processed = {}if (data.confirmedAtBlock && (typeof data.confirmedAtBlock.toNumber === 'function')) {processed.confirmedAt = data.confirmedAtBlock.toNumber();was wondering if the rename from
confirmedAtBlocktoconfirmedAtis so needed because now we call it differently in the kredits-contracts and kredits-webCode looks ok to me. Haven't tested it myself.
@@ -0,0 +2,4 @@const processed = {}if (data.confirmedAtBlock && (typeof data.confirmedAtBlock.toNumber === 'function')) {processed.confirmedAt = data.confirmedAtBlock.toNumber();It's not a rename, because it's the same property that returned the number before as well. The
confirmedAtBlockis the one from the contracts, which isn't formatted as a number.