diff --git a/app/components/match-page/MatchRosterTab.tsx b/app/components/match-page/MatchRosterTab.tsx index 4fda660bc..6dc9db8e9 100644 --- a/app/components/match-page/MatchRosterTab.tsx +++ b/app/components/match-page/MatchRosterTab.tsx @@ -119,6 +119,14 @@ function TeamRoster({ const [isEditing, setIsEditing] = useState(defaultIsEditing); const [selectedMemberIds, setSelectedMemberIds] = useState([]); + const rosterIdentity = rosterIdentityKey(team); + const [prevRosterIdentity, setPrevRosterIdentity] = useState(rosterIdentity); + if (rosterIdentity !== prevRosterIdentity) { + setPrevRosterIdentity(rosterIdentity); + setIsEditing(defaultIsEditing); + setSelectedMemberIds([]); + } + const dotClassName = side === "alpha" ? styles.teamOneDot : styles.teamTwoDot; const label = side === "alpha" ? t("q:match.sides.alpha") : t("q:match.sides.bravo"); @@ -252,6 +260,13 @@ function TeamRoster({ } } +function rosterIdentityKey(team: RosterTabTeam) { + return [ + team.members.map((member) => member.id).join("-"), + (team.subbedOut ?? []).join("-"), + ].join("_"); +} + function TeamHeader({ team, side,