fix(desktop): drop orphaned separators from sidebar section menus - #3661
Open
sumit-m wants to merge 1 commit into
Open
fix(desktop): drop orphaned separators from sidebar section menus#3661sumit-m wants to merge 1 commit into
sumit-m wants to merge 1 commit into
Conversation
The Sort and Delete section dividers rendered unconditionally, so a section whose earlier items are all absent opened its menu on a divider with nothing above it. Also gate the section-management block on the items it renders, not on `onDeleteSection`. Signed-off-by: sumit-m <33051892+sumit-m@users.noreply.github.com>
sumit-m
force-pushed
the
sidebar-section-menu-separator
branch
from
July 31, 2026 20:03
92007d2 to
effc64f
Compare
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.
What problem this solves
The sidebar section "more actions" menu (
SectionActionsMenu) renders every itemconditionally, but two of its dividers are unconditional. When the items above a
divider all happen to be absent, the menu opens on a divider with nothing
before it.
The built-in Channels header hits this in normal use.
AppSidebarsuppliesit only two things that can produce items:
onMarkAllRead, itself gated onhasUnreadsortMode/onSortModeChange)"Browse channels" is wired to the adjacent quick-create
+button, not into thismenu, and rename/move/delete apply only to user-created sections. So the menu has
two states, and one of them is broken:
Mark all as read· divider ·Sort— correctSort— orphaned dividerThat intermittency is why it reads as "sometimes broken": the divider is correct
right up until you read your last unread channel.
Fix
Compute whether anything actually precedes each divider and render it only then.
Two further points, same bug class, same component:
Delete sectiondivider has the identical flaw. Reachable when a sectionsupplies
onDeleteSectionbut no rename/move handlers and no sort preference.showSectionManagementwas gated ononRenameSection || onDeleteSection, butthe block it guards renders rename/move-up/move-down. A delete-only section
therefore opened the wrapper and emitted nothing — which would in turn make the
new "is anything above me" check wrong. Now gated on the items it renders.
Verification
Confirmed by state transition in a running dev app rather than by inspection —
opened the Channels menu with unread present, clicked
Mark all as read, thenreopened:
tsc --noEmitclean, biome clean, 3781 frontend unit tests pass.Notes for reviewers
Not platform-specific — nothing here depends on the host, and it reproduces
anywhere the Channels section has no unread items.
Conflict likely with #2947
(sidebar categories and manual channel ordering), which also touches
CustomChannelSection.tsxandAppSidebar.tsx. That PR adds sectionreordering, so it may introduce more conditional items above these dividers —
if it lands first, the
hasItemsBeforeSortexpression here needs its newhandlers added to the list. Happy to rebase behind it.