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

53 lines
2 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 9773
// Function ID: 9774
2026-08-08 06:10:11 +00:00
// Name: useGetGameForAppId
2026-08-24 06:08:38 +00:00
// Dependencies: [19, 4509, 7183, 5383, 1370, 589, 2]
2026-08-08 06:10:11 +00:00
// Exports: default, useGetGamesForAppIds
2026-08-24 06:08:38 +00:00
// Module 9773 (useGetGameForAppId)
import importDefaultResult1 from "importDefaultResult1" /* 5383 */;
import useGetOrFetchApplications from "useGetOrFetchApplications" /* 7183 */;
import closure_3 from "noop" /* 19 */;
import closure_4 from "handleLoadMessages" /* 4509 */;
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) {
2026-08-24 06:08:38 +00:00
const tmp = memo(7183)(stateFromStoresArray);
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);
2026-08-24 06:08:38 +00:00
const games = _require(5383).useGames(memo);
const obj = _require(5383);
const items1 = [closure_4];
return _require(589).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
});
};