Update sort order logic to consider search state

This commit is contained in:
2026-01-31 18:55:45 +01:00
parent 15e61635a9
commit 7d758364e6

View File

@@ -394,22 +394,24 @@ export default function App() {
const getNextTextSortOrder = useCallback(
(folderId: string | null) => {
if (hasSearch) return null;
const list = textsByFolder.get(folderId ?? null) ?? [];
const hasManualOrder = list.some((text) => text.sort_order !== null);
if (!hasManualOrder) return null;
return list.length;
},
[textsByFolder]
[hasSearch, textsByFolder]
);
const getNextFolderSortOrder = useCallback(
(parentId: string | null) => {
if (hasSearch) return null;
const list = foldersByParent.get(parentId ?? null) ?? [];
const hasManualOrder = list.some((folder) => folder.sort_order !== null);
if (!hasManualOrder) return null;
return list.length;
},
[foldersByParent]
[foldersByParent, hasSearch]
);
const isFolderExpanded = useCallback(