Skip to content

Conversation

@nshcr
Copy link
Contributor

@nshcr nshcr commented Feb 4, 2026

The previous file list component used different filename sorting rules in the tree view and list view.
This wasn't a major issue in the earlier changed files view, but it has become much more noticeable with the recently introduced all-in-one continuous files diff preview, which follows the same sorting order as the list view.

This PR fixes the issue by making both views use a unified sorting rule.

Copilot AI review requested due to automatic review settings February 4, 2026 17:03
@vercel
Copy link

vercel bot commented Feb 4, 2026

@nshcr is attempting to deploy a commit to the GitButler Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR unifies the file sorting rules between tree view and list view by extracting common sorting configuration into shared constants. Previously, the sortChildren function (used for tree view) and sortLikeFileTree function (used for list view) had slightly different sorting behaviors, which became noticeable with the new all-in-one continuous files diff preview feature.

Changes:

  • Introduced shared sorting constants FILE_SORT_CONFIG and FILE_SORT_LOCALE to ensure consistent sorting behavior
  • Updated both sortChildren and sortLikeFileTree functions to use the unified configuration
  • Removed inline sorting configuration that was previously defined within sortLikeFileTree

@krlvi krlvi requested a review from mtsgrd February 4, 2026 18:22
@krlvi
Copy link
Member

krlvi commented Feb 4, 2026

cc @mtsgrd

@mtsgrd
Copy link
Contributor

mtsgrd commented Feb 4, 2026

Amazing. Thank you! 🎉

@mtsgrd
Copy link
Contributor

mtsgrd commented Feb 4, 2026

Just one question, would FILE_SORT_LOCALE = undefined make it use the browsers locale? It might be better than explicitly setting en.

@mtsgrd mtsgrd merged commit 0dceba6 into gitbutlerapp:master Feb 4, 2026
28 of 30 checks passed
@mtsgrd
Copy link
Contributor

mtsgrd commented Feb 4, 2026

@PavelLaptev fyi!

@PavelLaptev
Copy link
Contributor

@nshcr awesome :-) Thanks!

@nshcr
Copy link
Contributor Author

nshcr commented Feb 4, 2026

Just one question, would FILE_SORT_LOCALE = undefined make it use the browsers locale? It might be better than explicitly setting en.

@mtsgrd Thanks for merging it!

I kept the locale set to en to avoid changing the existing code logic.
Yes, I think removing FILE_SORT_LOCALE and letting this parameter be undefined would be better.

For reference, in this PR (#10517), I also used formatting rules that respect the user's locale, which might be helpful for the software's localization in the future.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants