Skip to content

Conversation

@2003nayan
Copy link

@2003nayan 2003nayan commented Nov 25, 2025

feat: add alphabetical sorting option for folders in collections (#6190)

This PR adds support for alphabetical sorting of folders within collections.
Closes #6190.


Problem Statement

Older versions of Bruno (up to 2.2.0) automatically sorted folders alphabetically. This behavior was removed in later releases, creating confusion for users who depended on consistent folder ordering, especially in large collections or shared team setups. Many users requested an option to restore alphabetical sorting while preserving manual drag-and-drop workflows.


Solution

A new per-collection folder sorting mode is introduced, allowing users to choose between:

  • Manual ordering (default): Folders follow drag-and-drop order
  • Alphabetical ordering: Folders are sorted A→Z using locale-aware, natural, case-insensitive logic

Key Features

  • User control: Toggle between Manual and Alphabetical (A→Z) modes in the collection dropdown
  • Recursive sorting: Nested folders follow the same mode
  • Drag-and-drop handling: Disabled automatically when alphabetical mode is active
  • Git-friendly: Sort mode saved in bruno.json for consistent team behavior
  • Backward compatible: Defaults to manual mode
  • Natural sorting: Handles numerical names correctly (e.g., Item 2 < Item 10)

Implementation Details

Backend (bruno-electron)

  • Added folderSort field to the bruno.json schema ('manual' by default)
  • Added IPC handler renderer:update-folder-sort to persist changes

State Management (Redux)

  • Added updateFolderSort reducer to the collections slice
  • Added IPC-integrated action creator

Utilities

  • sortByNameOnly() — locale-aware alphabetical comparison
  • sortItemsBySortMode() — dispatches sorting logic based on mode

UI Components

  • Updated Collection and CollectionItem to apply new sorting
  • Added folder sort toggle in the collection dropdown
  • Integrated mode-based drag-and-drop control using react-dnd

User Experience Flow

  1. User opens the collection menu and sees the current sort mode
  2. Switching the mode immediately reorders folders
  3. A toast confirms the change
  4. Drag-and-drop is disabled in alphabetical mode
  5. Sort mode is persisted in bruno.json

Contribution Checklist

  • The pull request only addresses one issue or adds one feature
  • The pull request does not introduce breaking changes
  • Screenshots or GIFs added where applicable
  • Contribution guidelines reviewed
  • Issue created and linked (Closes #6190)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant