diff options
Diffstat (limited to 'frontend/app/components/GolfPlayApp.tsx')
| -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); |
