Repository navigation
Add a per-user folders-first sorting preference (#495) - #496
Open
zeropoint46 wants to merge 1 commit into
Open
zeropoint46 wants to merge 1 commit into
zeropoint46 wants to merge 1 commit into
Conversation
sortItems() always listed directories ahead of files, whatever key the folder was sorted on, so a date-sorted folder kept its newest files buried under months-old folders. The bucketing now waits for an option: foldersFirst defaults to true, so every list a person already had keeps the order it had, and turning the preference off sorts one list of files and folders together by the chosen key. The choice is a per-user preference like the others: a line in the backend's user settings, a switch in User Preferences, a default in the client store, and the two strings in every locale.
cerede2000
pushed a commit
to cerede2000/NextExplorer
that referenced
this pull request
Oct 3, 2026
Sorting has always put directories first, whatever the column: the check runs
before the chosen key on every comparison. For somebody whose new work arrives
as both files and folders that is wrong in a way the screen then denies —
sorted by date with the newest first, today's files sit below folders from
months ago, under a heading that says they are sorted newest first.
So it becomes the person's own choice, on by default, which leaves every list
exactly the order it had. `sortItems` takes `{ foldersFirst = true }`, the
settings store reads the preference, and the one place a listing is arranged
passes it.
This is nxzai#495, as proposed in nxzai#496 by zeropoint46: the same option, the
same name, the same default, the same two strings in all fifteen catalogues, so
that the two trees read alike if it lands there. What differs is where it is
wired — this tree arranges a listing in one function, `fileStore.arrange`,
because a pane that is not the one in front needs the same ordering of its own
listing.
Covered where each piece decides something: the sort with folders mixed in by
name and by size, the preference reading an unset value as on and only an
explicit no as off, the switch carried through the settings screen's stored
fixture and its exact-payload save, and the boolean round-tripping through the
route like every other user preference.
Collaborator
|
hi @zeropoint46 thanks for the contribution. I will merge it asap. and thanks for pointing out the failing tests. let me check and fix those tests too and I will merge your changes. Thanks ! |
Author
any progress on this @vikramsoni2 ? |
This branch has not been deployed
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.
Closes #495
Problem
sortItems()infrontend/src/stores/files/sorting.jsbuckets directories ahead of files unconditionally — theisDirDiffcheck runs before the sort key on every comparison ("keep directories first"). Whatever a folder is sorted by, its newest files land below months-old folders. In a media library where new content arrives as both loose files and folders, a date-descending list can bury everything worth watching under old directories.Approach
The bucketing becomes conditional on an option, and the option is a per-user preference like the others:
sortItems(items, sortBy, folderSizeFor, { foldersFirst = true })— the default keeps every existing list exactly the order it had.foldersFirst: asBoolean), a switch in Settings → User Preferences (after the sidebar group, before quick actions), a default (true) in the client's user-settings store, and the two strings in every locale.Turning it off sorts one list of files and folders together by the chosen key; the per-folder sort memory keeps working either way.
Tests
fileStore.listing.spec.js: folders-first still holds whatever the key and the direction; with the preference off, one mixed list by name and one by size.SettingsUserPreferences.spec.js: the switch is threaded through the stored fixture, the exact-payload save test, and its own save round-trip.settings.test.jsand the route test: the boolean persists and round-trips like the other user preferences.Notes for review
maincurrently has pre-existing test failures unrelated to this PR (thesettings.ffmpeg.*keys from ffmpeg moved to another custom docker image #490 are not yet translated, plus the openapi copy and a static-server deep-route test). Verified on a pristinemaincheckout that the same failures exist there; this branch adds no new failures.