mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor(editor): Fix types issues in src/components/Node/* (no-changelog) (#9444)
Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
This commit is contained in:
@@ -86,16 +86,20 @@ export function flattenCreateElements(items: INodeCreateElement[]): INodeCreateE
|
||||
|
||||
export function groupItemsInSections(
|
||||
items: INodeCreateElement[],
|
||||
sections: NodeViewItemSection[],
|
||||
sections: string[] | NodeViewItemSection[],
|
||||
): INodeCreateElement[] {
|
||||
const filteredSections = sections.filter(
|
||||
(section): section is NodeViewItemSection => typeof section === 'object',
|
||||
);
|
||||
|
||||
const itemsBySection = items.reduce((acc: Record<string, INodeCreateElement[]>, item) => {
|
||||
const section = sections.find((s) => s.items.includes(item.key));
|
||||
const section = filteredSections.find((s) => s.items.includes(item.key));
|
||||
const key = section?.key ?? 'other';
|
||||
acc[key] = [...(acc[key] ?? []), item];
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const result: SectionCreateElement[] = sections
|
||||
const result: SectionCreateElement[] = filteredSections
|
||||
.map(
|
||||
(section): SectionCreateElement => ({
|
||||
type: 'section',
|
||||
|
||||
Reference in New Issue
Block a user