feat(preview): sort directories before files in directory preview#3343
feat(preview): sort directories before files in directory preview#3343finedesignz wants to merge 1 commit into
Conversation
Group directories ahead of files in the directory preview table (Windows Explorer / VSCode style), while preserving the active column sort within each group. The ".." entry remains pinned to the top. Closes wavetermdev#2541
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR modifies the preview directory component to apply Windows Explorer-style row ordering in the file browser. The Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
Groups directories ahead of files in the directory preview table — the familiar Windows Explorer / VSCode ordering — while preserving the active column sort (Name or Last Modified, asc/desc) within each group. The
..entry stays pinned at the top.Closes #2541
What changed
frontend/app/view/preview/preview-directory.tsx— after the sorted row model is computed, the non-..rows are partitioned into directories and files via the existingrow.original.isdirfield, then concatenated (dirs first). This keeps TanStack Table's column sort intact inside each group and is direction-independent (folders stay first whether sorting name asc/desc or by modtime), matching native file-manager behavior.Notes
preview:directoriesfirstboolean setting alongside the existingpreview:defaultsortif maintainers prefer opt-in/out — say the word and I'll add the Go const, schema entry, docs row, and context-menu toggle.FileInfo.isdirandrow.original(typedFileInfo) are already used throughout this file, so it's type-safe. Did not run a fulltask buildlocally; CI will validate.Test plan
..is still the first row.