Keep folders at top when sorting assemblies

This commit is contained in:
2025-10-04 01:49:31 -06:00
parent 4ae74343d7
commit 87dee574e1

View File

@@ -62,11 +62,14 @@ const Island = ({ title, description, icon, actions, children, sx }) => (
// ---------------- Workflows Island -----------------
const sortTree = (node) => {
if (!node || !Array.isArray(node.children)) return;
node.children.sort((a, b) =>
String(a.label || "").localeCompare(String(b.label || ""), undefined, {
node.children.sort((a, b) => {
const aFolder = Boolean(a.isFolder);
const bFolder = Boolean(b.isFolder);
if (aFolder !== bFolder) return aFolder ? -1 : 1;
return String(a.label || "").localeCompare(String(b.label || ""), undefined, {
sensitivity: "base"
})
);
});
});
node.children.forEach(sortTree);
};