diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-03-21 11:37:48 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-03-21 11:37:48 +0900 |
| commit | 95903269b252729ee6573a5b607d98fa0223cd9a (patch) | |
| tree | cfed9b4320cb5c0f83364fbe8e5517b59bb10d73 /frontend/app | |
| parent | 4b58aed45bb2356786958b4ce10b62ede26dfdb3 (diff) | |
| download | phperkaigi-2025-albatross-95903269b252729ee6573a5b607d98fa0223cd9a.tar.gz phperkaigi-2025-albatross-95903269b252729ee6573a5b607d98fa0223cd9a.tar.zst phperkaigi-2025-albatross-95903269b252729ee6573a5b607d98fa0223cd9a.zip | |
fix(frontend): fix submission status flickering
Diffstat (limited to 'frontend/app')
| -rw-r--r-- | frontend/app/components/GolfPlayApp.tsx | 23 |
1 files changed, 14 insertions, 9 deletions
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); |
