Skip to content

fix(explorer): sort untitled documents in natural numeric order - #266

Merged
ThisIs-Developer merged 2 commits into
ThisIs-Developer:mainfrom
mikah13:fix/natural-sort-untitled-titles
Oct 2, 2026
Merged

ThisIs-Developer merged 2 commits into
ThisIs-Developer:mainfrom
mikah13:fix/natural-sort-untitled-titles

Conversation

@mikah13

@mikah13 mikah13 commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • Add compareNatural() helper in script.js using localeCompare(..., undefined, { numeric: true, sensitivity: 'base' }).
  • Apply natural sort to document titles in:
    • flat document view (renderFlatDocumentView)
    • folder documents and workspace-root documents in sidebar (renderWorkspaceTree)
  • Apply natural sort to folder names and move-dialog folder paths for consistency.

Why

Plain localeCompare sorts lexically, so Untitled 12 sorted before Untitled 2 (Untitled 1, Untitled 12, Untitled 2). New files created via nextUntitledTitle() (Untitled <counter>) hit this as soon as the counter reached 10+.

How it was tested

  • node --check script.js — passed.
  • Sort repro:
    • OLD: Untitled 1, Untitled 10, Untitled 12, Untitled 2, Untitled 9
    • NEW: Untitled 1, Untitled 2, Untitled 9, Untitled 10, Untitled 12
  • npm run test:unit — fails identically on main (missing marked package, pre-existing, unrelated).

@vercel

vercel Bot commented Oct 1, 2026

Copy link
Copy Markdown

@mikah13 is attempting to deploy a commit to the Developer Labs Team on Vercel.

A member of the Team first needs to authorize it.

@mikah13 mikah13 changed the title fix: natural sort for untitled document titles fix(explorer): sort untitled documents in natural numeric order Oct 1, 2026
@mikah13
mikah13 marked this pull request as ready for review October 1, 2026 18:46
@vercel

vercel Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
markdown-viwer Ready Ready Preview Oct 2, 2026 6:44am UTC

@ThisIs-Developer ThisIs-Developer left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The natural sorting fix looks good and correctly addresses the "Untitled 10" / "Untitled 2" ordering issue.

However, the Vercel build is currently failing because "script.js" was updated without syncing the desktop resource:

"desktop-app/resources/js/script.js"

Please run:

"node desktop-app/prepare.js"

Then commit the regenerated desktop file(s) and verify that:

"npm run build"

passes successfully.

Also, please consider whether "sensitivity: 'base'" is actually required. If the goal is only natural numeric sorting, "{ numeric: true }" should be sufficient and would keep the change more focused.

Once the desktop resources are synced and the build passes, this should be ready for another review. 👍

@mikah13

mikah13 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

The natural sorting fix looks good and correctly addresses the "Untitled 10" / "Untitled 2" ordering issue.

However, the Vercel build is currently failing because "script.js" was updated without syncing the desktop resource:

"desktop-app/resources/js/script.js"

Please run:

"node desktop-app/prepare.js"

Then commit the regenerated desktop file(s) and verify that:

"npm run build"

passes successfully.

Also, please consider whether "sensitivity: 'base'" is actually required. If the goal is only natural numeric sorting, "{ numeric: true }" should be sufficient and would keep the change more focused.

Once the desktop resources are synced and the build passes, this should be ready for another review. 👍

Thanks for checking, I will get that resolved

Natural numeric ordering only needs { numeric: true }. Keeping the
default sensitivity preserves the existing case and accent ordering.
Regenerated desktop-app/resources/js/script.js via desktop-app/prepare.js.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TDrHCrk7dhaiJdUkCNxgY6
@ThisIs-Developer
ThisIs-Developer dismissed their stale review October 2, 2026 07:11

Great work on this fix. Approved. 👍

@ThisIs-Developer

Copy link
Copy Markdown
Owner

Thanks for addressing the requested changes. Really appreciate the effort and the clean follow-up on the review feedback.

The latest Vercel deployment is also passing successfully.

Great work on this fix. Approved. 👍

@ThisIs-Developer
ThisIs-Developer merged commit 0feac0d into ThisIs-Developer:main Oct 2, 2026
4 checks passed
@ThisIs-Developer ThisIs-Developer added the bug Something is broken or not working as expected. label Oct 2, 2026 — with ChatGPT Codex Connector

This branch was successfully deployed

1 active deployment
Preview — 660203be Deployed Oct 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something is broken or not working as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants