Skip to content

Commit

Permalink
Show IndexedDB-related operations on Splash screen
Browse files Browse the repository at this point in the history
First half of the progress is for storing the response to IndexedDB (if
a response was received) and the second half for reading the values
from database and casting to ThunderstoreMod objects to be stored in
Vuex.

Add a helper for resetting progress of all subitems on the splash
screen.
  • Loading branch information
anttimaki committed Apr 3, 2024
1 parent 9c7fef8 commit 446af67
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/components/mixins/SplashMixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ export default class SplashMixin extends Vue {
return this.requests.reduce((x, y) => x.merge(y));
}
resetRequestProgresses() {
this.requests.forEach((request) => request.setProgress(0));
}
// Get the list of game-specific packages to exclude.
async getExclusions() {
this.loadingText = 'Connecting to GitHub repository';
Expand Down Expand Up @@ -76,7 +80,9 @@ export default class SplashMixin extends Vue {
this.loadingText = 'You may be offline or Thunderstore is unavailabe. Checking cache.';
}
this.getRequestItem('CacheOperations').setProgress(50);
await this.$store.dispatch('tsMods/updateMods');
this.getRequestItem('CacheOperations').setProgress(100);
if (this.$store.state.tsMods.modsLastUpdated === undefined) {
this.heroTitle = 'Failed to get mods from Thunderstore and cache';
Expand Down
7 changes: 3 additions & 4 deletions src/pages/Splash.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ export default class Splash extends mixins(SplashMixin) {
requests = [
new RequestItem('UpdateCheck', 0),
new RequestItem('ThunderstoreDownload', 0),
new RequestItem('ExclusionsList', 0)
new RequestItem('ExclusionsList', 0),
new RequestItem('CacheOperations', 0)
];
// Ensure that r2modman isn't outdated.
Expand Down Expand Up @@ -194,9 +195,7 @@ export default class Splash extends mixins(SplashMixin) {
}
retryConnection() {
this.getRequestItem('UpdateCheck').setProgress(0);
this.getRequestItem('ExclusionsList').setProgress(0);
this.getRequestItem('ThunderstoreDownload').setProgress(0);
this.resetRequestProgresses();
this.isOffline = false;
this.checkForUpdates();
}
Expand Down

0 comments on commit 446af67

Please sign in to comment.