fix: Action children not triggerable
This commit is contained in:
@@ -18,7 +18,8 @@ function resolve<T>(value: any, context: ActionContext): T {
|
||||
export function createAction(definition: Optional<Action, "id">): Action {
|
||||
return {
|
||||
...definition,
|
||||
perform: (context) => {
|
||||
perform: definition.perform
|
||||
? (context) => {
|
||||
// We muse use the specific analytics name here as the action name is
|
||||
// translated and potentially contains user strings.
|
||||
if (definition.analyticsName) {
|
||||
@@ -32,7 +33,8 @@ export function createAction(definition: Optional<Action, "id">): Action {
|
||||
}
|
||||
|
||||
return definition.perform?.(context);
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
id: uuidv4(),
|
||||
};
|
||||
}
|
||||
@@ -115,7 +117,7 @@ export function actionToKBar(
|
||||
keywords: action.keywords ?? "",
|
||||
shortcut: action.shortcut || [],
|
||||
icon: resolvedIcon,
|
||||
perform: () => action.perform?.(context),
|
||||
perform: action.perform ? () => action.perform?.(context) : undefined,
|
||||
},
|
||||
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
|
||||
].concat(children.map((child) => ({ ...child, parent: action.id })));
|
||||
|
||||
Reference in New Issue
Block a user