26 lines
881 B
TypeScript
26 lines
881 B
TypeScript
// Metro module 8479 (f8480).
|
|
import { useMemo } from "react";
|
|
import { useGetOrFetchApplication } from "../../applications/useGetOrFetchApplications";
|
|
import { useGame } from "./useGame";
|
|
export default function useResolveGame({ applicationId, gameId }) {
|
|
const getOrFetchApplication = useGetOrFetchApplication(gameId == null ? applicationId : void 0);
|
|
const memo = useMemo(() => {
|
|
let r1 = gameId;
|
|
if (gameId == null) {
|
|
r1 = getOrFetchApplication == null ? null : getOrFetchApplication.getCanonicalGameId();
|
|
}
|
|
return r1;
|
|
}, [gameId, getOrFetchApplication]);
|
|
const game = useGame(memo);
|
|
let data = game.data;
|
|
const isLoading = game.isLoading;
|
|
if (data == null) {
|
|
data = null;
|
|
}
|
|
return {
|
|
gameId: memo,
|
|
gameRecord: data,
|
|
isLoading: gameId == null && applicationId != null && getOrFetchApplication == null || isLoading
|
|
};
|
|
};
|