fix(desktop): surface leave-channel rejection in sidebar dialog - #3689
Open
iroiro147 wants to merge 1 commit into
Open
fix(desktop): surface leave-channel rejection in sidebar dialog#3689iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
Leaving a channel you solely owner was silently rejected: the sidebar
dialog closed immediately regardless of success or failure, and the
relay's error message ("you are the only owner") never reached the user.
This change adds error and pending state to LeaveChannelAlertDialog:
- The dialog stays open when the mutation fails, showing the relay's
error message as a destructive-foreground paragraph
- The dialog only closes on successful mutation
- Cancel and Leave buttons are disabled while the request is in flight
- A new leave request clears any prior error
This matches the behavior already present in ChannelManagementSheet's
leave button, which does surface errors. The two entry points now agree.
Closes block#3605
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Leaving a channel you solely own looks like a broken button. You confirm the dialog, it closes, and the channel is still sitting in the sidebar — no toast, no error, no explanation. The relay is refusing on purpose (it won't remove a channel's last owner), but the reason never reaches the UI.
Closes #3605
Root Cause
The sidebar's
LeaveChannelAlertDialog(inChannelSectionDialogs.tsx) calledleaveChannel.mutate()and immediately cleared the target — closing the dialog regardless of success or failure. The mutation's.errorfield was never read or displayed.In contrast, the
ChannelManagementSheetleave button does surface errors vialeaveChannelMutation.error.message. The two entry points disagreed about whether failures are worth mentioning.Solution
Added error and pending state to the sidebar's leave dialog:
LeaveChannelAlertDialogpropserror?: Error | nullandisPending?: booleanerror.messageas atext-destructiveparagraph inside the dialogisPending; Leave shows "Leaving...".mutate()(fire-and-forget) to.mutateAsync().then(() => close)onOpenChangeblocked whileisPendingto prevent premature dismissalAcceptance Criteria
Test Plan
cd desktop node --test src/features/sidebar/ui/leaveChannelDialog.test.mjsAll 6 tests pass: