mirror of
https://github.com/LCE-Hub/LCE-Emerald-Launcher.git
synced 2026-09-23 08:32:51 +00:00
fix: branch cycling logic
This commit is contained in:
@@ -178,15 +178,20 @@ export function useGameManager({
|
|||||||
if (available.length <= 1) return;
|
if (available.length <= 1) return;
|
||||||
setSelectedBranches(prev => {
|
setSelectedBranches(prev => {
|
||||||
const current = prev[editionId] || available[0];
|
const current = prev[editionId] || available[0];
|
||||||
const currentIndex = available.indexOf(current);
|
let currentIndex = available.indexOf(current);
|
||||||
const nextIndex = (currentIndex + 1) % available.length;
|
let nextIndex = currentIndex;
|
||||||
const nextBranch = available[nextIndex];
|
let nextBranch = current;
|
||||||
const oldInstanceId = current === "Stable" ? editionId : `${editionId}_${current}`;
|
do {
|
||||||
const newInstanceId = nextBranch === "Stable" ? editionId : `${editionId}_${nextBranch}`;
|
nextIndex = (nextIndex + 1) % available.length;
|
||||||
|
nextBranch = available[nextIndex];
|
||||||
|
} while (nextBranch.startsWith("v") && nextIndex !== currentIndex);
|
||||||
|
const oldInstanceId =
|
||||||
|
current === "Stable" ? editionId : `${editionId}_${current}`;
|
||||||
|
const newInstanceId =
|
||||||
|
nextBranch === "Stable" ? editionId : `${editionId}_${nextBranch}`;
|
||||||
if (profile === oldInstanceId) {
|
if (profile === oldInstanceId) {
|
||||||
setProfile(newInstanceId);
|
setProfile(newInstanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { ...prev, [editionId]: nextBranch };
|
return { ...prev, [editionId]: nextBranch };
|
||||||
});
|
});
|
||||||
}, [branches, profile, setProfile]);
|
}, [branches, profile, setProfile]);
|
||||||
|
|||||||
Reference in New Issue
Block a user