Fix: Order folders, md files, then chat threads

Co-authored-by: gemini-3.7-flash <noreply@google.com>
This commit is contained in:
2026-08-16 19:57:43 -07:00
parent 7d921e5289
commit 59d72da2a9

View File

@@ -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; let sortedThreads=[],isAddingThreads=false;const THREAD_PAGE_SIZE=50;
async function renderThreads(){ async function renderThreads(){
sortedThreads=[...THREAD.list].filter(t=>t.status!=='deleted').sort((a,b)=>{ sortedThreads=[...THREAD.list].filter(t=>t.status!=='deleted').sort((a,b)=>{
if(a.type==='file'&&b.type!=='file')return -1; const r=t=>t.type==='folder'?0:t.type==='file'?1:2;
if(a.type!=='file'&&b.type==='file')return 1; return (r(a)-r(b))||(b.pinned-a.pinned)||(b.updatedAt-a.updatedAt);
return (b.pinned-a.pinned)||(b.updatedAt-a.updatedAt);
}); });
el.threadList.innerHTML=sortedThreads.slice(0,THREAD_PAGE_SIZE).map(threadRow).join(''); el.threadList.innerHTML=sortedThreads.slice(0,THREAD_PAGE_SIZE).map(threadRow).join('');
el.threadList.scrollTop=0; el.threadList.scrollTop=0;