mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-20 00:23:58 +01:00
Fix environment sorting
This commit is contained in:
@@ -331,12 +331,7 @@ const treeAtom = atom<TreeNode<TreeModel> | null>((get) => {
|
||||
|
||||
const parent = root.children?.[0];
|
||||
if (baseEnvironments.length <= 1 && parent != null) {
|
||||
const sortedEnvironments = [...subEnvironments].sort((a, b) => {
|
||||
if (a.sortPriority === b.sortPriority) return a.updatedAt > b.updatedAt ? 1 : -1;
|
||||
else return a.sortPriority - b.sortPriority;
|
||||
});
|
||||
|
||||
parent.children = sortedEnvironments.map((item) => ({
|
||||
parent.children = subEnvironments.map((item) => ({
|
||||
item,
|
||||
parent,
|
||||
depth: 1,
|
||||
|
||||
Reference in New Issue
Block a user