diff --git a/src/components/Gallery/index.tsx b/src/components/Gallery/index.tsx index 1944664..7db986c 100644 --- a/src/components/Gallery/index.tsx +++ b/src/components/Gallery/index.tsx @@ -1,16 +1,12 @@ import { useNavigate } from "react-router-dom"; -import { useRoomIdStore, useTargetStatusStore } from "../../store"; +import { useRoomIdStore } from "../../store"; import styles from "./index.module.css"; function Gallery() { const navigate = useNavigate(); const updateUUID = useRoomIdStore((state) => state.updateUUID); - const resetTargetStatus = useTargetStatusStore( - (state) => state.resetTargetStatus, - ); const handleClick = () => { - resetTargetStatus(); updateUUID(); navigate("/"); }; diff --git a/src/pages/yatai/index.tsx b/src/pages/yatai/index.tsx index 596ebe5..a92dd9d 100644 --- a/src/pages/yatai/index.tsx +++ b/src/pages/yatai/index.tsx @@ -1,9 +1,20 @@ +import { useEffect } from "react"; import Gallery from "../../components/Gallery"; import { TargetOverlay } from "../../components/Yatai/TargetOverlay"; import { YataiStage } from "../../components/Yatai/YataiStage"; +import { useTargetStatusStore } from "../../store"; import styles from "./index.module.css"; function Yatai() { + const resetTargetStatus = useTargetStatusStore( + (state) => state.resetTargetStatus, + ); + + // init target status + useEffect(() => { + resetTargetStatus(); + }, [resetTargetStatus]); + return (