Skip to content

[Feature] Add sorting modes to the plugin store#4398

Open
DavidGBrett wants to merge 2 commits intoFlow-Launcher:devfrom
DavidGBrett:sorting-options-on-plugin-store
Open

[Feature] Add sorting modes to the plugin store#4398
DavidGBrett wants to merge 2 commits intoFlow-Launcher:devfrom
DavidGBrett:sorting-options-on-plugin-store

Conversation

@DavidGBrett
Copy link
Copy Markdown
Contributor

@DavidGBrett DavidGBrett commented Apr 8, 2026

Summary

Add dropdown with sorting modes to the plugin store panel of the settings window.
Added the following modes:

  • Default
  • Name
  • Release Date
  • Updated Date

Default matches the current way it lists plugins, included the recently added / recently updated categories.
The other modes hide those categories as they no longer make sense / are needed, leaving only "Plugins" and "Installed".

Related to this request:
https://www.reddit.com/r/FlowLauncher/comments/1s8gcrm/plugin_sort_by_date_created_or_updated/

Closes #2845

UI

image (ignore the missing plugin icons - that just always happens in my local debug mode)

Summary by cubic

Adds sorting to the Plugin Store (Default, Name, Release Date, Updated Date) with a new dropdown. Non‑default sorts group plugins into only “Installed” and “Plugins”.

Summary of changes

  • Changed
    • External plugin list now sorted via GetSortedPlugins based on SelectedSortMode.
    • Default grouping uses DefaultCategory; non‑default sorts group by InstallCategory.
    • XAML grouping switched from Category to DefaultCategory; header layout adjusted to fit the dropdown.
  • Added
    • Sorting dropdown (localized) and PluginStoreSortMode enum (Default, Name, ReleaseDate, UpdatedDate).
    • DateAdded and UpdatedDate to PluginStoreItemViewModel for sorting.
    • InstallCategory and UpdateCategoryGrouping to switch grouping on sort mode changes.
    • Refresh of the collection view when SelectedSortMode changes.
  • Removed
    • Previous hard‑coded ordering chain in ExternalPlugins.
    • Category property in PluginStoreItemViewModel (replaced by DefaultCategory).
  • Memory impact
    • Minimal. Same materialization of plugin list as before; small static list for sort modes.
  • Security risks
    • None. UI and in‑memory sorting only.
  • Unit tests
    • No new tests included.

Written for commit c6da34b. Summary will update on new commits.

- Added new row in header
- Added dropdown menu to that new row
- Added localized options: "Name", "Release Date," "Updated Date" as well as a localized label "Sorting Mode:"

No functionality added, only ui changes.
- Add GetSortedPlugins to handle different sorts based on the SelectedSortMode
- Show only "None"/"Plugins" & "Installed" categories for sort modes other than default
@github-actions github-actions bot added this to the 2.2.0 milestone Apr 8, 2026
@prlabeler prlabeler bot added the bug Something isn't working label Apr 8, 2026
@DavidGBrett DavidGBrett changed the title Sorting options on plugin store [Feature] Add sorting modes to the plugin store Apr 8, 2026
@prlabeler prlabeler bot added the enhancement New feature or request label Apr 8, 2026
@DavidGBrett DavidGBrett marked this pull request as ready for review April 8, 2026 16:05
@gitstream-cm
Copy link
Copy Markdown

gitstream-cm bot commented Apr 8, 2026

🥷 Code experts: Jack251970

Jack251970 has most 👩‍💻 activity in the files.
Jack251970 has most 🧠 knowledge in the files.

See details

Flow.Launcher/Languages/en.xaml

Activity based on git-commit:

Jack251970
APR 0 additions & 1 deletions
MAR
FEB 7 additions & 4 deletions
JAN
DEC
NOV

Knowledge based on git-blame:
Jack251970: 99%

Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs

Activity based on git-commit:

Jack251970
APR
MAR 1 additions & 1 deletions
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
Jack251970: 100%

Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml

Activity based on git-commit:

Jack251970
APR
MAR
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
Jack251970: 100%

Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs

Activity based on git-commit:

Jack251970
APR
MAR
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
Jack251970: 100%

Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs

Activity based on git-commit:

Jack251970
APR
MAR
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
Jack251970: 100%

✨ Comment /gs review for LinearB AI review. Learn how to automate it here.

@gitstream-cm
Copy link
Copy Markdown

gitstream-cm bot commented Apr 8, 2026

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

📝 Walkthrough

Walkthrough

This PR implements a sorting feature for the Plugin Store, enabling users to sort plugins by name, release date, updated date, or the default categorization. Changes include new localization entries, a sort mode enum with dropdown UI binding, refactored category properties on plugin items, and dynamic grouping logic that adjusts based on the selected sort mode.

Changes

Cohort / File(s) Summary
Localization
Flow.Launcher/Languages/en.xaml
Added 5 new string resource keys for sort mode options (Default, Name, Release Date, Updated Date) and the combobox label.
ViewModel Logic
Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs
Introduced PluginStoreSortMode enum and SortModeData class; added SortModes list and SelectedSortMode property with change notifications; refactored ExternalPlugins to delegate sorting via GetSortedPlugins(...) based on selected mode; added UpdateEnumDropdownLocalizations() and parameterless constructor.
View Layout & Binding
Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml
Reorganized header panel layout with vertical orientation; changed grouping from Category to DefaultCategory; added sort mode combobox bound to SortModes and SelectedSortMode; updated row sizing from fixed 72 to Auto; adjusted search textbox styling and positioning.
View Code-Behind
Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs
Introduced UpdateCategoryGrouping() method to dynamically adjust CollectionViewSource grouping based on SelectedSortMode (groups by DefaultCategory when Default mode, otherwise by InstallCategory); integrated grouping updates into OnNavigatedTo() and ViewModel_PropertyChanged().
Plugin Item Model
Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs
Added DateAdded and UpdatedDate properties for sorting; refactored category logic by renaming Category to DefaultCategory (retains recency-based grouping) and introducing InstallCategory (computed as "Installed" or "None" based on local presence).

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as ComboBox (Sort Mode)
    participant VM as SettingsPanePluginStoreViewModel
    participant CodeBehind as SettingsPanePluginStore.xaml.cs
    participant CVS as CollectionViewSource
    participant Items as PluginStoreItemViewModel List

    User->>UI: Select sort mode
    UI->>VM: SelectedSortMode = new value
    VM->>VM: Raise PropertyChanged("SelectedSortMode")<br/>Raise PropertyChanged("ExternalPlugins")
    CodeBehind->>CodeBehind: ViewModel_PropertyChanged triggered
    CodeBehind->>CodeBehind: UpdateCategoryGrouping()
    CodeBehind->>CVS: Clear GroupDescriptions
    alt SelectedSortMode == Default
        CodeBehind->>CVS: Group by DefaultCategory
    else SelectedSortMode != Default
        CodeBehind->>CVS: Group by InstallCategory
    end
    VM->>Items: GetSortedPlugins(SelectedSortMode)
    Items->>Items: Sort by Name/ReleaseDate/UpdatedDate<br/>or by DefaultCategory
    CodeBehind->>CVS: Refresh collection view
    CVS->>UI: Update displayed items
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • onesounds
  • Jack251970
  • jjw24
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding sorting modes to the plugin store.
Linked Issues check ✅ Passed The PR fully implements the objectives from #2845: adds sorting by name, release date, and updated date, plus a default mode that preserves existing behavior.
Out of Scope Changes check ✅ Passed All changes are scoped to implementing the sorting feature. Property renames (Category→DefaultCategory) and grouping adjustments support the sorting functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description clearly explains the feature being added: a dropdown for sorting plugins in the plugin store with four modes (Default, Name, Release Date, Updated Date), and specifies how grouping behavior changes based on the selected sort mode.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs (1)

44-64: ⚠️ Potential issue | 🟠 Major

Potential null reference issue with nullable DateTime arithmetic.

_newPlugin.LatestReleaseDate and _newPlugin.DateAdded are DateTime? (per UserPlugin.cs lines 68-73). Subtracting a nullable DateTime? from DateTime.Now without null checks can cause runtime exceptions or undefined behavior when these values are null.

🛠️ Proposed fix with null checks
 public string DefaultCategory
 {
     get
     {
         string category = None;
-        if (DateTime.Now - _newPlugin.LatestReleaseDate < TimeSpan.FromDays(7))
+        if (_newPlugin.LatestReleaseDate.HasValue && 
+            DateTime.Now - _newPlugin.LatestReleaseDate.Value < TimeSpan.FromDays(7))
         {
             category = RecentlyUpdated;
         }
-        if (DateTime.Now - _newPlugin.DateAdded < TimeSpan.FromDays(7))
+        if (_newPlugin.DateAdded.HasValue && 
+            DateTime.Now - _newPlugin.DateAdded.Value < TimeSpan.FromDays(7))
         {
             category = NewRelease;
         }
         if (_oldPluginPair != null)
         {
             category = Installed;
         }

         return category;
     }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs` around lines 44 - 64,
The DefaultCategory getter performs DateTime.Now - _newPlugin.LatestReleaseDate
and DateTime.Now - _newPlugin.DateAdded where those fields are nullable
(DateTime?); guard these uses by checking _newPlugin.LatestReleaseDate.HasValue
and _newPlugin.DateAdded.HasValue (or using GetValueOrDefault with an existence
check) before doing the subtraction, and only assign RecentlyUpdated/NewRelease
when the corresponding nullable has a value; keep the existing logic around
_oldPluginPair and the returned category intact.
🧹 Nitpick comments (1)
Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs (1)

88-105: Minor formatting inconsistency.

Line 102: else{ is missing a space before the brace.

🔧 Suggested fix
         // Otherwise we only split by installed or not
-        else{
+        else
+        {
             groupDescriptions.Add(new PropertyGroupDescription(nameof(PluginStoreItemViewModel.InstallCategory)));
         }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs` around
lines 88 - 105, The method UpdateCategoryGrouping has a formatting
inconsistency: change the `else{` to `else {` to match project style; update the
else block in UpdateCategoryGrouping (which currently adds a
PropertyGroupDescription for PluginStoreItemViewModel.InstallCategory when
_viewModel.SelectedSortMode is not PluginStoreSortMode.Default) so the brace
spacing is corrected.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs`:
- Around line 44-64: The DefaultCategory getter performs DateTime.Now -
_newPlugin.LatestReleaseDate and DateTime.Now - _newPlugin.DateAdded where those
fields are nullable (DateTime?); guard these uses by checking
_newPlugin.LatestReleaseDate.HasValue and _newPlugin.DateAdded.HasValue (or
using GetValueOrDefault with an existence check) before doing the subtraction,
and only assign RecentlyUpdated/NewRelease when the corresponding nullable has a
value; keep the existing logic around _oldPluginPair and the returned category
intact.

---

Nitpick comments:
In `@Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs`:
- Around line 88-105: The method UpdateCategoryGrouping has a formatting
inconsistency: change the `else{` to `else {` to match project style; update the
else block in UpdateCategoryGrouping (which currently adds a
PropertyGroupDescription for PluginStoreItemViewModel.InstallCategory when
_viewModel.SelectedSortMode is not PluginStoreSortMode.Default) so the brace
spacing is corrected.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 64000be2-df6c-4096-9f7e-77ba3461f3b4

📥 Commits

Reviewing files that changed from the base of the PR and between 3e320d5 and c6da34b.

📒 Files selected for processing (5)
  • Flow.Launcher/Languages/en.xaml
  • Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs
  • Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml
  • Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs
  • Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs

@DavidGBrett
Copy link
Copy Markdown
Contributor Author

DavidGBrett commented Apr 8, 2026

⚠️ Outside diff range comments (1)

Flow.Launcher/ViewModel/PluginStoreItemViewModel.cs (1)> 44-64: ⚠️ Potential issue | 🟠 Major

Potential null reference issue with nullable DateTime arithmetic.

This is unrelated to my change, this is an issue in the existing code.
Not sure if this should really be addressed in this PR.

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

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sorting option in plugin store menu

1 participant