diff --git a/src/features/application-menu/main/menu-items/get-composite/get-composite-paths/get-composite-paths.ts b/src/features/application-menu/main/menu-items/get-composite/get-composite-paths/get-composite-paths.ts index f977cbcacd..46abf49f46 100644 --- a/src/features/application-menu/main/menu-items/get-composite/get-composite-paths/get-composite-paths.ts +++ b/src/features/application-menu/main/menu-items/get-composite/get-composite-paths/get-composite-paths.ts @@ -3,26 +3,10 @@ * Licensed under MIT License. See LICENSE in root directory for more information. */ import { pipeline } from "@ogre-tools/fp"; -import { flatMap } from "lodash/fp"; +import { map } from "lodash/fp"; import type { Composite } from "../get-composite"; +import { normalizeComposite } from "../normalize-composite/normalize-composite"; export const getCompositePaths = ( - composite: Composite, - previousPath: string[] = [], -): string[] => { - const currentPath = [...previousPath, composite.id]; - - const currentPathString = currentPath.join("."); - - return [ - currentPathString, - - ...pipeline( - composite.children, - - flatMap((childComposite) => - getCompositePaths(childComposite, currentPath), - ), - ), - ]; -}; + composite: Composite, +): string[] => pipeline(composite, normalizeComposite, map(([path]) => path));