diff --git a/app/components/SubmitButton.tsx b/app/components/SubmitButton.tsx index 559a5e38c..5fc0a11a5 100644 --- a/app/components/SubmitButton.tsx +++ b/app/components/SubmitButton.tsx @@ -16,11 +16,14 @@ export function SubmitButton( const [showSuccess, setShowSuccess] = useTimeoutState(false); useEffect(() => { - if ((!successText && !onSuccess) || actionData?.ok !== actionType) return; + // did this submit button's action happen? + if (actionData?.ok !== actionType) return; + // this is essentially to ensure this only fires once per mutation + if (transition.type !== "actionReload") return; onSuccess?.(); setShowSuccess(true); - }, [actionData]); + }, [actionData?.ok, transition.type]); const isLoading = (): boolean => { // is there an action happening at the moment? diff --git a/app/components/tournament/DuringMatchActionsRosters.tsx b/app/components/tournament/DuringMatchActionsRosters.tsx index b41368788..0990623bb 100644 --- a/app/components/tournament/DuringMatchActionsRosters.tsx +++ b/app/components/tournament/DuringMatchActionsRosters.tsx @@ -21,7 +21,7 @@ export function DuringMatchActionsRosters({ const [checkedPlayers, setCheckedPlayers] = React.useState< [string[], string[]] >(checkedPlayersInitialState([ownTeam, opponentTeam])); - const [winnerId, setWinnerId] = React.useState(null); + const [winnerId, setWinnerId] = React.useState(); return (
@@ -35,8 +35,7 @@ export function DuringMatchActionsRosters({ type="radio" id={team.id} name="winnerTeamId" - value={team.id} - onChange={(e) => setWinnerId(e.currentTarget.value)} + onChange={() => setWinnerId(team.id)} checked={winnerId === team.id} />