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

47 lines
1.4 KiB
TypeScript
Raw Normal View History

// Module ID: 8805
// Function ID: 8806
2026-07-20 16:05:17 +00:00
// Name: useResolveGame
// Dependencies: [19, 7275, 7416, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 8805 (useResolveGame)
import useGetOrFetchApplications from "useGetOrFetchApplications" /* 7275 */;
import useGame from "useGame" /* 7416 */;
import noop from "module_19" /* 19 */;
2026-07-20 16:05:17 +00:00
require = fn;
const size = fn(2);
const result = size.fileFinishedImporting("modules/games/hooks/useResolveGame.tsx");
2026-07-20 16:05:17 +00:00
export default function useResolveGame(arg0) {
({ applicationId, gameId } = arg0);
2026-07-23 10:11:24 +00:00
let getOrFetchApplication;
2026-07-29 08:29:29 +00:00
let tmp3;
2026-07-20 16:05:17 +00:00
if (null == gameId) {
2026-07-29 08:29:29 +00:00
tmp3 = applicationId;
2026-07-20 16:05:17 +00:00
}
getOrFetchApplication = useGetOrFetchApplications.useGetOrFetchApplication(tmp3);
2026-07-20 16:05:17 +00:00
const items = [gameId, getOrFetchApplication];
const memo = noop.useMemo(() => {
2026-07-29 08:29:29 +00:00
let tmp = gameId;
if (null == gameId) {
let canonicalGameId = null;
2026-07-20 16:05:17 +00:00
if (null != getOrFetchApplication) {
2026-07-29 08:29:29 +00:00
canonicalGameId = obj.getCanonicalGameId();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp = canonicalGameId;
obj = getOrFetchApplication;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp;
2026-07-20 16:05:17 +00:00
}, items);
const game = useGame.useGame(memo);
2026-07-29 08:29:29 +00:00
let data = game.data;
const obj2 = { gameId: memo, gameRecord: null, isLoading: null };
2026-07-29 08:29:29 +00:00
if (data == null) {
data = null;
2026-07-20 16:05:17 +00:00
}
obj2.gameRecord = data;
obj2.isLoading = null == gameId && null != applicationId && null == getOrFetchApplication || game.isLoading;
return obj2;
2026-07-20 16:05:17 +00:00
};