From 479b55ac76f63c7d1205003b3c35a30216285090 Mon Sep 17 00:00:00 2001 From: rasguy92 Date: Sat, 9 Dec 2023 00:12:36 +0700 Subject: [PATCH] fix: items load normally again --- src/common/GameBar/index.tsx | 2 +- src/components/WegaGames/index.tsx | 4 +++- src/main.tsx | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/common/GameBar/index.tsx b/src/common/GameBar/index.tsx index 4ea41c4..cfdd308 100644 --- a/src/common/GameBar/index.tsx +++ b/src/common/GameBar/index.tsx @@ -54,7 +54,7 @@ function GameBar({ const { user, network } = useWegaStore(); const tokenDecimals: number = SupportedWagerTokenAddresses[game?.wager.wagerCurrency as AllPossibleCurrencyTypes][game?.networkId as number].decimals as number; - return game && user?.uuid && network ? ( + return game && user?.uuid && network && tokenDecimals ? ( {/* date */} {dateFromTs(new Date(game.createdAt as string).getTime() * 1000)} diff --git a/src/components/WegaGames/index.tsx b/src/components/WegaGames/index.tsx index 88360d2..21fbb43 100644 --- a/src/components/WegaGames/index.tsx +++ b/src/components/WegaGames/index.tsx @@ -22,6 +22,7 @@ export const JoinableAndPlayableGames: React.FC = const { data, isLoading, isSuccess} = useGetGamesQuery({ networkId: networkId ?? defaultNetwork?.id }); const [gameIds, setGameIds] = useState([]); useEffect(() => { + console.log(data) if(isSuccess && data && data?.entities) { const dataArray = data.ids.map((id: number) => data.entities[id]) as Wega[]; const playableGames = filterPlayableGames(dataArray, userUuid); @@ -30,6 +31,7 @@ export const JoinableAndPlayableGames: React.FC = const sortedGameIds = sortPlayableGames([...playableGames, ...joinableGames, ...waitingGames]).map(game => game.id); setGameIds(sortedGameIds); } + console.log(gameIds) }, [data, gamesCount, isSuccess, defaultNetwork?.id]); return !isLoading ? (
@@ -41,7 +43,7 @@ export const JoinableAndPlayableGames: React.FC = { - gameIds && gameIds.map((gameId: number) => ( )) + gameIds ? gameIds.map((gameId: number) => ( )) : <> }
) : diff --git a/src/main.tsx b/src/main.tsx index 6ebebcd..d993670 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -7,10 +7,9 @@ import { gamesApiSlice } from './components/WegaGames/apiSlice.ts' import './themes/index.css' import GlobalStyles from "./themes/GlobalStyles.tsx"; import WalletProvider from './containers/WalletProvider/index.tsx' -import { defaultNetwork } from "./models/constants.ts"; // TODO // remove old api files -store.dispatch(gamesApiSlice.endpoints.getGames.initiate({ networkId: defaultNetwork?.id })); +store.dispatch(gamesApiSlice.endpoints.getGames.initiate(undefined)); ReactDOM.createRoot(document.getElementById("root")!).render(