Skip to content

Commit

Permalink
Rename Vuex store attributes and methods
Browse files Browse the repository at this point in the history
The "background" update originally referred to the periodic updates,
i.e. not the update that happens on splash screen and shows the
progress to user. The Vuex state is now shared between the background
updates and user triggered manual updates that show a lightweight
status reporting, so the naming was bit misleading.
  • Loading branch information
anttimaki committed Dec 20, 2024
1 parent 2e99b41 commit b0419fd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/components/ModListUpdateBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default class ModListUpdateBanner extends mixins(UtilityMixin) {
}
get isUpdateInProgress(): boolean {
return this.$store.state.tsMods.isBackgroundUpdateInProgress;
return this.$store.state.tsMods.isThunderstoreModListUpdateInProgress;
}
@Watch('isUpdateInProgress')
Expand All @@ -34,7 +34,7 @@ export default class ModListUpdateBanner extends mixins(UtilityMixin) {
return;
}
this.$store.commit('tsMods/startBackgroundUpdate');
this.$store.commit('tsMods/startThunderstoreModListUpdate');
this.updateError = '';
try {
Expand All @@ -48,7 +48,7 @@ export default class ModListUpdateBanner extends mixins(UtilityMixin) {
} catch (e) {
this.updateError = `${e}`;
} finally {
this.$store.commit('tsMods/finishBackgroundUpdate');
this.$store.commit('tsMods/finishThunderstoreModListUpdate');
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/mixins/UtilityMixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ export default class UtilityMixin extends Vue {
return;
}
if (this.$store.state.tsMods.isBackgroundUpdateInProgress) {
if (this.$store.state.tsMods.isThunderstoreModListUpdateInProgress) {
return;
}
try {
this.$store.commit("tsMods/startBackgroundUpdate");
this.$store.commit("tsMods/startThunderstoreModListUpdate");
await this.refreshThunderstoreModList();
} catch (e) {
if (this.tsBackgroundRefreshFailed) {
Expand All @@ -75,7 +75,7 @@ export default class UtilityMixin extends Vue {
this.tsBackgroundRefreshFailed = true;
return;
} finally {
this.$store.commit("tsMods/finishBackgroundUpdate");
this.$store.commit("tsMods/finishThunderstoreModListUpdate");
}
this.tsBackgroundRefreshFailed = false;
Expand Down
8 changes: 4 additions & 4 deletions src/components/settings-components/SettingsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ import CdnProvider from '../../providers/generic/connection/CdnProvider';
'Refresh online mod list',
'Check for any new mod releases.',
async () => {
if (this.$store.state.tsMods.isBackgroundUpdateInProgress) {
if (this.$store.state.tsMods.isThunderstoreModListUpdateInProgress) {
return "Checking for new releases";
}
if (this.$store.state.tsMods.connectionError.length > 0) {
Expand All @@ -312,19 +312,19 @@ import CdnProvider from '../../providers/generic/connection/CdnProvider';
},
'fa-exchange-alt',
async () => {
if (this.$store.state.tsMods.isBackgroundUpdateInProgress) {
if (this.$store.state.tsMods.isThunderstoreModListUpdateInProgress) {
return;
}
this.$store.commit("tsMods/startBackgroundUpdate");
this.$store.commit("tsMods/startThunderstoreModListUpdate");
this.$store.commit("tsMods/setConnectionError", "");
try {
await this.refreshThunderstoreModList();
} catch (e) {
this.$store.commit("tsMods/setConnectionError", e);
} finally {
this.$store.commit("tsMods/finishBackgroundUpdate");
this.$store.commit("tsMods/finishThunderstoreModListUpdate");
}
}
),
Expand Down
14 changes: 7 additions & 7 deletions src/store/modules/TsModsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface State {
connectionError: string;
deprecated: Map<string, boolean>;
exclusions?: string[];
isBackgroundUpdateInProgress: boolean;
isThunderstoreModListUpdateInProgress: boolean;
mods: ThunderstoreMod[];
modsLastUpdated?: Date;
}
Expand Down Expand Up @@ -54,8 +54,8 @@ export const TsModsModule = {
deprecated: new Map<string, boolean>(),
/*** Packages available through API that should be ignored by the manager */
exclusions: undefined,
/*** Mod list is automatically and periodically updated in the background */
isBackgroundUpdateInProgress: false,
/*** Mod list is updated from the API automatically and by user action */
isThunderstoreModListUpdateInProgress: false,
/*** All mods available through API for the current active game */
mods: [],
/*** When was the mod list last refreshed from the API? */
Expand Down Expand Up @@ -128,8 +128,8 @@ export const TsModsModule = {
clearModCache(state) {
state.cache.clear();
},
finishBackgroundUpdate(state) {
state.isBackgroundUpdateInProgress = false;
finishThunderstoreModListUpdate(state) {
state.isThunderstoreModListUpdateInProgress = false;
},
setConnectionError(state, error: string|unknown) {
if (typeof error === 'string') {
Expand All @@ -148,8 +148,8 @@ export const TsModsModule = {
setExclusions(state, payload: string[]) {
state.exclusions = payload;
},
startBackgroundUpdate(state) {
state.isBackgroundUpdateInProgress = true;
startThunderstoreModListUpdate(state) {
state.isThunderstoreModListUpdateInProgress = true;
},
updateDeprecated(state, allMods: ThunderstoreMod[]) {
state.deprecated = Deprecations.getDeprecatedPackageMap(allMods);
Expand Down

0 comments on commit b0419fd

Please sign in to comment.