Enhance caching mechanism by adding future promise to cached function and updating maps retrieval logic to use it
All checks were successful
SteamWarCI Build successful

This commit is contained in:
2025-06-29 13:54:03 +02:00
parent a99a066f0d
commit 887235dc86
2 changed files with 16 additions and 5 deletions

View File

@@ -55,7 +55,7 @@ export const gamemodes = cached<string[]>([], async () => {
});
export const maps = cachedFamily<string, string[]>([], async (gamemode) => {
if (get(gamemodes).every((value) => value !== gamemode)) return [];
if ((await gamemodes.future).every((value) => value !== gamemode)) return [];
const res = await fetchWithToken(get(tokenStore), `/data/admin/gamemodes/${gamemode}/maps`);
if (!res.ok) {