diff --git a/src/components/pages/game/game.tsx b/src/components/pages/game/game.tsx index ae9b7e5..e2e7765 100644 --- a/src/components/pages/game/game.tsx +++ b/src/components/pages/game/game.tsx @@ -132,6 +132,22 @@ export const GameSection = () => { }; }, [isPending, currentPendingImage]); + useEffect(() => { + if (!showTip) { + return; + } + + const handler = (event: BeforeUnloadEvent) => { + event.preventDefault(); + }; + + window.addEventListener('beforeunload', handler); + + return () => { + window.removeEventListener('beforeunload', handler); + }; + }, [showTip]); + return (