From 95903269b252729ee6573a5b607d98fa0223cd9a Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Fri, 21 Mar 2025 11:37:48 +0900
Subject: fix(frontend): fix submission status flickering

---
 frontend/app/components/GolfPlayApp.tsx | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

(limited to 'frontend/app/components/GolfPlayApp.tsx')

diff --git a/frontend/app/components/GolfPlayApp.tsx b/frontend/app/components/GolfPlayApp.tsx
index 25b81af..7953bac 100644
--- a/frontend/app/components/GolfPlayApp.tsx
+++ b/frontend/app/components/GolfPlayApp.tsx
@@ -61,15 +61,20 @@ export default function GolfPlayApp({ game, player, initialGameState }: Props) {
 		}
 	}, 1000);
 
-	const onCodeSubmit = useDebouncedCallback(async (code: string) => {
-		if (code === "") {
-			return;
-		}
-		console.log("player:c2s:submit");
-		handleSubmitCodePre();
-		await apiClient.postGamePlaySubmit(game.game_id, code);
-		handleSubmitCodePost();
-	}, 1000);
+	const onCodeSubmit = useDebouncedCallback(
+		async (code: string) => {
+			if (code === "") {
+				return;
+			}
+			console.log("player:c2s:submit");
+			handleSubmitCodePre();
+			await apiClient.postGamePlaySubmit(game.game_id, code);
+			await new Promise((resolve) => setTimeout(resolve, 2000));
+			handleSubmitCodePost();
+		},
+		1000,
+		{ leading: true },
+	);
 
 	const [isDataPolling, setIsDataPolling] = useState(false);
 
-- 
cgit v1.3.1

