decord/source/modules/games/hooks/useGetGameForAppId.tsx
github-actions 777dc50a28 chore: update source for alpha 346.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
2026-09-10 19:12:31 +00:00

55 lines
2 KiB
TypeScript

// Module ID: 9250
// Function ID: 9251
// Name: useGetGameForAppId
// Dependencies: [19, 1916, 7220, 7361, 1369, 504, 2]
// Exports: default, useGetGamesForAppIds
// Module 9250 (useGetGameForAppId)
import GlobalUtils from "GlobalUtils" /* 1369 */;
import useGetOrFetchApplications from "useGetOrFetchApplications" /* 7220 */;
import useGame from "useGame" /* 7361 */;
import noop from "module_19" /* 19 */;
import GameStore from "GameStore" /* 1916 */;
const require = globalThis.__r;
require = fn;
const size = fn(2);
const result = size.fileFinishedImporting("modules/games/hooks/useGetGameForAppId.tsx");
export default function useGetGameForAppId(applicationId) {
const getOrFetchApplication = useGetOrFetchApplications.useGetOrFetchApplication(applicationId);
let canonicalGameId;
if (getOrFetchApplication != null) {
canonicalGameId = getOrFetchApplication.getCanonicalGameId();
}
if (canonicalGameId == null) {
canonicalGameId = null;
}
const game = useGame.useGame(canonicalGameId);
let data = game.data;
const obj2 = { gameId: canonicalGameId, gameRecord: null, isLoading: null };
if (data == null) {
data = null;
}
obj2.gameRecord = data;
obj2.isLoading = null != applicationId && null == getOrFetchApplication || game.isLoading;
return obj2;
};
export const useGetGamesForAppIds = function useGetGamesForAppIds(stateFromStoresArray) {
const tmp = memo(7220)(stateFromStoresArray);
_require = tmp;
const items = [tmp];
memo = noop.useMemo(() => {
const found = closure_0.filter(GlobalUtils.isNotNullish);
const mapped = found.map((getCanonicalGameId) => getCanonicalGameId.getCanonicalGameId());
return mapped.filter(GlobalUtils.isNotNullish);
}, items);
const games = require("useGame").useGames(memo);
const obj = require("useGame");
const items1 = [GameStore];
return require("initialize").useStateFromStoresArray(items1, () => {
const mapped = memo.map((item) => game.getGame(item));
return mapped.filter(GlobalUtils.isNotNullish);
});
};