Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): Fix displaying of some trigger nodes in the creator panel #5040

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions packages/editor-ui/src/stores/nodeCreator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,16 @@ export const useNodeCreatorStore = defineStore(STORES.NODE_CREATOR, {
return nodesWithActions;
},
mergedAppNodes(): INodeTypeDescription[] {
const mergedNodes = this.visibleNodesWithActions.reduce(
(acc: Record<string, INodeTypeDescription>, node: INodeTypeDescription) => {
const mergedNodes = [...this.visibleNodesWithActions]
// Sort triggers so they are always on top and when later get merged
// they won't be discarded if they have the same name as a core node which doesn't contain actions
.sort((a, b) => {
if (a.group.includes('trigger')) return -1;
if (b.group.includes('trigger')) return 1;

return 0;
})
.reduce((acc: Record<string, INodeTypeDescription>, node: INodeTypeDescription) => {
const clonedNode = deepCopy(node);
const isCoreNode = node.codex?.categories?.includes(CORE_NODES_CATEGORY);
const actions = node.actions || [];
Expand All @@ -324,14 +332,15 @@ export const useNodeCreatorStore = defineStore(STORES.NODE_CREATOR, {
acc[normalizedName].displayName = node.displayName.replace('Trigger', '');
}

acc[normalizedName].actions = filterSinglePlaceholderAction(
acc[normalizedName].actions || [],
);
return acc;
},
{},
);
return Object.values(mergedNodes);
}, {});

const filteredNodes = Object.values(mergedNodes).map((node) => ({
...node,
actions: filterSinglePlaceholderAction(node.actions || []),
}));

return filteredNodes;
},
getNodeTypesWithManualTrigger:
() =>
Expand Down