generated from nhcarrigan/template
fix: sort injected entries by canonical defaults order after sync
This commit is contained in:
@@ -533,6 +533,13 @@ const injectMissingEntries = <T extends { id: string }>(
|
|||||||
added = added + 1;
|
added = added + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const defaultOrder = new Map(defaults.map((item, index) => {
|
||||||
|
return [ item.id, index ] as const;
|
||||||
|
}));
|
||||||
|
existing.sort((itemA, itemB) => {
|
||||||
|
return (defaultOrder.get(itemA.id) ?? Number.MAX_SAFE_INTEGER)
|
||||||
|
- (defaultOrder.get(itemB.id) ?? Number.MAX_SAFE_INTEGER);
|
||||||
|
});
|
||||||
return added;
|
return added;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2304,6 +2304,7 @@ export const GameProvider = ({
|
|||||||
startQuest,
|
startQuest,
|
||||||
state,
|
state,
|
||||||
syncError,
|
syncError,
|
||||||
|
syncNewContent,
|
||||||
toggleAutoAdventurer,
|
toggleAutoAdventurer,
|
||||||
toggleAutoBoss,
|
toggleAutoBoss,
|
||||||
toggleAutoPrestige,
|
toggleAutoPrestige,
|
||||||
@@ -2313,7 +2314,6 @@ export const GameProvider = ({
|
|||||||
unlockedAchievements,
|
unlockedAchievements,
|
||||||
unlockedCodexEntryIds,
|
unlockedCodexEntryIds,
|
||||||
unlockedStoryChapterIds,
|
unlockedStoryChapterIds,
|
||||||
syncNewContent,
|
|
||||||
};
|
};
|
||||||
}, [
|
}, [
|
||||||
apotheosis,
|
apotheosis,
|
||||||
|
|||||||
Reference in New Issue
Block a user