From 59d72da2a9775d23a0eb91a043ec33fce5220dc7 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Sun, 16 Aug 2026 19:57:43 -0700 Subject: [PATCH] Fix: Order folders, md files, then chat threads Co-authored-by: gemini-3.7-flash --- src/main.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main.js b/src/main.js index c7246e4..4ae7cad 100644 --- a/src/main.js +++ b/src/main.js @@ -45,9 +45,8 @@ const threadRow=t=>{const icon=t.type==='folder'?'folder':(t.type==='file'?'file let sortedThreads=[],isAddingThreads=false;const THREAD_PAGE_SIZE=50; async function renderThreads(){ sortedThreads=[...THREAD.list].filter(t=>t.status!=='deleted').sort((a,b)=>{ - if(a.type==='file'&&b.type!=='file')return -1; - if(a.type!=='file'&&b.type==='file')return 1; - return (b.pinned-a.pinned)||(b.updatedAt-a.updatedAt); + const r=t=>t.type==='folder'?0:t.type==='file'?1:2; + return (r(a)-r(b))||(b.pinned-a.pinned)||(b.updatedAt-a.updatedAt); }); el.threadList.innerHTML=sortedThreads.slice(0,THREAD_PAGE_SIZE).map(threadRow).join(''); el.threadList.scrollTop=0;