hoist remove prompt out of conditional

confirming the prompt optimistically drops the row, which would unmount
the prompt mid-close and race the dismiss animation on native. only the
button needs gating behind showRemoveButton.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-06-08 15:33:06 +03:00
parent 6c61ee44cc
commit 16fb52b40b
@@ -153,7 +153,6 @@ export function Member({
</ProfileCard.Outer> </ProfileCard.Outer>
</ProfileCard.Link> </ProfileCard.Link>
{showRemoveButton ? ( {showRemoveButton ? (
<>
<Button <Button
label={l`Remove ${displayName} from this group chat`} label={l`Remove ${displayName} from this group chat`}
size="tiny" size="tiny"
@@ -163,12 +162,6 @@ export function Member({
<Trans>Remove</Trans> <Trans>Remove</Trans>
</ButtonText> </ButtonText>
</Button> </Button>
<RemoveMemberPrompt
control={removeMemberPrompt}
displayName={displayName}
onConfirm={() => removeMembers({members: [profile.did]})}
/>
</>
) : isSelf || isFollowing || isBlockedOrBlocking(profile) ? null : ( ) : isSelf || isFollowing || isBlockedOrBlocking(profile) ? null : (
<SimpleInlineLinkText <SimpleInlineLinkText
label={l`Follow ${displayName}`} label={l`Follow ${displayName}`}
@@ -179,6 +172,14 @@ export function Member({
)} )}
{statusBadge} {statusBadge}
</View> </View>
{/* Mounted outside the showRemoveButton conditional: confirming the
prompt optimistically drops this row, so gating the prompt on the
button would unmount it mid-close and race the dismiss animation. */}
<RemoveMemberPrompt
control={removeMemberPrompt}
displayName={displayName}
onConfirm={() => removeMembers({members: [profile.did]})}
/>
</SubtleHoverWrapper> </SubtleHoverWrapper>
) )
} }