fix: sort visualize tree (#6110)

Co-authored-by: k k <kleangseu@yahoo.com>
This commit is contained in:
Leangseu Kim 2023-02-07 22:02:12 -05:00 committed by GitHub
parent bba1d1b574
commit 26dcc007e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,7 +104,7 @@ export default {
const truncatePath = path => _.take(path.split('/'), depth).join('/') const truncatePath = path => _.take(path.split('/'), depth).join('/')
const descendantsByChild = const descendantsByChild =
Object.entries(_.groupBy(descendants, page => truncatePath(page.path))) Object.entries(_.groupBy(descendants, page => truncatePath(page.path)))
.map(([childPath, descendantsGroup]) => [getPage(childPath), descendantsGroup]) .map(([childPath, descendantsGroup]) => [getPage(childPath), _.sortBy(descendantsGroup, child => child.path)])
.map(([child, descendantsGroup]) => .map(([child, descendantsGroup]) =>
[child, _.filter(descendantsGroup, d => d.path !== child.path)]) [child, _.filter(descendantsGroup, d => d.path !== child.path)])
return { return {