Fix beta->latest->beta upgrade loop (#6189)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2022-09-15 08:02:14 -04:00
1 parent b428518857
commit a784ca70b1
8 files changed
+81 -39

No files matched your search

@@ -19,10 +19,7 @@ const checkForUpdatesStartingFromChannelInjectable = getInjectable({
id: "check-for-updates-starting-from-channel",
instantiate: (di) => {
const checkForPlatformUpdates = di.inject(
checkForPlatformUpdatesInjectable,
);
const checkForPlatformUpdates = di.inject(checkForPlatformUpdatesInjectable);
const updateCanBeDowngraded = di.inject(updateCanBeDowngradedInjectable);
const _recursiveCheck = async (
@@ -5,24 +5,19 @@
import { getInjectable } from "@ogre-tools/injectable";
import { computed } from "mobx";
import selectedUpdateChannelInjectable from "../../../common/application-update/selected-update-channel/selected-update-channel.injectable";
import appVersionInjectable from "../../../common/vars/app-version.injectable";
import { SemVer } from "semver";
import releaseChannelInjectable from "../../../common/vars/release-channel.injectable";
const updateCanBeDowngradedInjectable = getInjectable({
id: "update-can-be-downgraded",
instantiate: (di) => {
const selectedUpdateChannel = di.inject(selectedUpdateChannelInjectable);
const appVersion = di.inject(appVersionInjectable);
const releaseChannel = di.inject(releaseChannelInjectable);
return computed(() => {
const semVer = new SemVer(appVersion);
return (
semVer.prerelease[0] !==
selectedUpdateChannel.value.get().id
);
});
return computed(() => (
selectedUpdateChannel.value.get().id === "latest"
&& releaseChannel !== "latest"
));
},
});