Problem
The View → Sort by menu sets UserDefaultsManagement.sort (the global default), but when a folder with a per-folder sort override is selected, the sort does not change. The per-folder setting (set via right-click → Show Options → Sort by) always takes priority in buildSortBy() (Storage.swift:1475), and the View menu does not update it.
This means the View menu sort appears to "do nothing" for any folder that has an explicit per-folder sort set.
Root Cause
In ViewController.sortBy() (ViewController.swift:537), only UserDefaultsManagement.sort is updated. The per-folder project.settings.sortBy is not touched. Then buildSortBy() checks per-folder first and ignores the global:
public func buildSortBy() {
if let project = self.searchQuery.projects.first, project.settings.sortBy != .none {
self.sortByState = project.settings.sortBy // per-folder wins, global ignored
...
return
}
...
self.sortByState = UserDefaultsManagement.sort // only reached if per-folder is .none
}
Expected Behavior
When a folder is selected and the user changes the sort via the View menu, the sort should take effect immediately on the visible note list. This means updating the per-folder project.settings.sortBy as well.
Suggested Fix
In ViewController.sortBy(), also update the currently selected folder's sort setting:
if let sidebarProjects = sidebarOutlineView.getSidebarProjects(), let project = sidebarProjects.first {
if sortBy == project.settings.sortBy {
project.settings.sortDirection = project.settings.sortDirection == .asc ? .desc : .asc
}
project.settings.sortBy = sortBy
project.saveSettings()
}
Environment
- FSNotes 7.1.1
- macOS 15 Sequoia
Problem
The View → Sort by menu sets
UserDefaultsManagement.sort(the global default), but when a folder with a per-folder sort override is selected, the sort does not change. The per-folder setting (set via right-click → Show Options → Sort by) always takes priority inbuildSortBy()(Storage.swift:1475), and the View menu does not update it.This means the View menu sort appears to "do nothing" for any folder that has an explicit per-folder sort set.
Root Cause
In
ViewController.sortBy()(ViewController.swift:537), onlyUserDefaultsManagement.sortis updated. The per-folderproject.settings.sortByis not touched. ThenbuildSortBy()checks per-folder first and ignores the global:Expected Behavior
When a folder is selected and the user changes the sort via the View menu, the sort should take effect immediately on the visible note list. This means updating the per-folder
project.settings.sortByas well.Suggested Fix
In
ViewController.sortBy(), also update the currently selected folder's sort setting:Environment