Commit 0859c7ff authored by Chunchi Che's avatar Chunchi Che

fix HintNotification.tsx

parent 2aa3893b
Pipeline #21407 passed with stages
in 18 minutes and 9 seconds
...@@ -11,12 +11,12 @@ const MsgWin = ygopro.StocGameMessage.MsgWin; ...@@ -11,12 +11,12 @@ const MsgWin = ygopro.StocGameMessage.MsgWin;
const NeosConfig = useConfig(); const NeosConfig = useConfig();
export const HintNotification = () => { export const HintNotification = () => {
const hintState = matStore.hint; const snap = useSnapshot(matStore);
const hintSnap = useSnapshot(matStore.hint); const hintState = snap.hint;
const currentPhase = matStore.phase.currentPhase; const currentPhase = snap.phase.currentPhase;
const waiting = matStore.waiting; const waiting = snap.waiting;
const result = matStore.result; const result = snap.result;
const navigate = useNavigate(); const navigate = useNavigate();
...@@ -30,7 +30,7 @@ export const HintNotification = () => { ...@@ -30,7 +30,7 @@ export const HintNotification = () => {
placement: "bottom", placement: "bottom",
}); });
} }
}, [hintSnap?.msg]); }, [hintState.msg]);
useEffect(() => { useEffect(() => {
if (currentPhase) { if (currentPhase) {
......
...@@ -19,7 +19,8 @@ const { ...@@ -19,7 +19,8 @@ const {
const Mora = () => { const Mora = () => {
const snapMora = useSnapshot(moraStore); const snapMora = useSnapshot(moraStore);
const snapMatInitInfo = useSnapshot(matStore.initInfo); const snapMat = useSnapshot(matStore);
const meLife = snapMat.initInfo.me.life;
const selectHandAble = snapMora.selectHandAble; const selectHandAble = snapMora.selectHandAble;
const selectTpAble = snapMora.selectTpAble; const selectTpAble = snapMora.selectTpAble;
...@@ -42,10 +43,10 @@ const Mora = () => { ...@@ -42,10 +43,10 @@ const Mora = () => {
useEffect(() => { useEffect(() => {
// 若对局已经开始,自动跳转 // 若对局已经开始,自动跳转
if (snapMatInitInfo.me.life > 0) { if (meLife > 0) {
navigate(`/duel/${player}/${passWd}/${ip}`); navigate(`/duel/${player}/${passWd}/${ip}`);
} }
}, [snapMatInitInfo.me]); }, [meLife]);
useEffect(() => { useEffect(() => {
if (isAiMode) { if (isAiMode) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment