fix(treasurechest): fix sorting for children #97
@@ -305,7 +305,13 @@ func sortTree(nodes []*types.TreasureChest) []*types.TreasureChest {
|
||||
|
||||
for _, root := range roots {
|
||||
result = append(result, root)
|
||||
result = append(result, children[root.Id]...)
|
||||
|
||||
childList := children[root.Id]
|
||||
|
||||
slices.SortFunc(childList, func(a, b *types.TreasureChest) int {
|
||||
return compareStrings(a.Name, b.Name)
|
||||
})
|
||||
result = append(result, childList...)
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user