Skip to content

Commit

Permalink
chore: request
Browse files Browse the repository at this point in the history
  • Loading branch information
cjkoepke committed Dec 3, 2024
1 parent d95e936 commit 717094a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/components/DoomCanvas/DoomCanvas.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import React, { useCallback, useEffect, useRef, useState } from "react";
import React, {
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from "react";
import { EGameType, EmscriptenModule, NewGameResponse } from "../../types";
import { useAppContext } from "../../context/useAppContext";
import { getArgs } from "../../utils/game";
Expand All @@ -25,13 +31,17 @@ const DoomCanvas: React.FC = () => {
const urlClipboard = useClipboard({ copiedTimeout: 1500 });
const { newGame, addPlayer, share } = useUrls();
const [isLoading, setIsLoading] = useState(true);
const mutationKey = useMemo(
() => ["fetchGameData", address, code, type],
[address, code, type],
);

const {
mutate: fetchGameData,
data,
isError,
} = useMutation<NewGameResponse>({
mutationKey: ["fetchGameData", address, code, type],
mutationKey,
mutationFn: async () => {
if (type === EGameType.SOLO) {
return { game_id: "solo" };
Expand Down

0 comments on commit 717094a

Please sign in to comment.