decord/source/modules/games/hooks/useGetGameForAppId.tsx

53 lines
2 KiB
TypeScript
Raw Normal View History

// Module ID: 9186
// Function ID: 9187
2026-08-08 06:10:11 +00:00
// Name: useGetGameForAppId
// Dependencies: [19, 1916, 7168, 7309, 1369, 504, 2]
2026-08-08 06:10:11 +00:00
// Exports: default, useGetGamesForAppIds
// Module 9186 (useGetGameForAppId)
import useGetOrFetchApplications from "useGetOrFetchApplications" /* 7168 */;
import importDefaultResult1 from "importDefaultResult1" /* 7309 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "noop" /* 19 */;
import closure_4 from "createGamesFromMessage" /* 1916 */;
2026-08-08 06:10:11 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
const result = require("set").fileFinishedImporting("modules/games/hooks/useGetGameForAppId.tsx");
2026-08-08 06:10:11 +00:00
export default function useGetGameForAppId(applicationId) {
2026-08-24 06:08:38 +00:00
let obj = useGetOrFetchApplications;
2026-08-08 06:10:11 +00:00
const getOrFetchApplication = obj.useGetOrFetchApplication(applicationId);
let canonicalGameId;
if (getOrFetchApplication != null) {
canonicalGameId = getOrFetchApplication.getCanonicalGameId();
}
if (canonicalGameId == null) {
canonicalGameId = null;
}
2026-08-24 06:08:38 +00:00
const game = importDefaultResult1.useGame(canonicalGameId);
2026-08-08 06:10:11 +00:00
let data = game.data;
obj = { gameId: canonicalGameId, gameRecord: null, isLoading: null };
if (data == null) {
data = null;
}
obj[1] = data;
obj[2] = null != applicationId && null == getOrFetchApplication || game.isLoading;
return obj;
};
export const useGetGamesForAppIds = function useGetGamesForAppIds(stateFromStoresArray) {
const tmp = memo(7168)(stateFromStoresArray);
2026-08-24 06:08:38 +00:00
const _require = tmp;
2026-08-08 06:10:11 +00:00
const items = [tmp];
memo = React.useMemo(() => {
2026-08-24 06:08:38 +00:00
const found = lib.filter(lib(closure_1_2[4]).isNotNullish);
2026-08-08 06:10:11 +00:00
const mapped = found.map((getCanonicalGameId) => getCanonicalGameId.getCanonicalGameId());
2026-08-24 06:08:38 +00:00
return mapped.filter(lib(closure_1_2[4]).isNotNullish);
2026-08-08 06:10:11 +00:00
}, items);
const games = _require(7309).useGames(memo);
const obj = _require(7309);
2026-08-24 06:08:38 +00:00
const items1 = [closure_4];
return _require(504).useStateFromStoresArray(items1, () => {
2026-08-08 06:10:11 +00:00
const mapped = memo.map((closure_0) => game.getGame(closure_0));
2026-08-24 06:08:38 +00:00
return mapped.filter(lib(closure_1_2[4]).isNotNullish);
2026-08-08 06:10:11 +00:00
});
};