mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Use filtered items in finding the default action catalog add button (#4170)
This commit is contained in:
1 parent
be8e350510
commit
079976d703
1 file changed
+3
-2
@@ -73,8 +73,9 @@ export class CatalogAddButton extends React.Component<CatalogAddButtonProps> {
|
||||
|
||||
@boundMethod
|
||||
onButtonClick() {
|
||||
const defaultAction = this.menuItems.find(item => item.defaultAction)?.onClick;
|
||||
const clickAction = defaultAction || (this.menuItems.length === 1 ? this.menuItems[0].onClick : null);
|
||||
const filteredItems = this.props.category ? this.props.category.filteredItems(this.menuItems) : [];
|
||||
const defaultAction = filteredItems.find(item => item.defaultAction)?.onClick;
|
||||
const clickAction = defaultAction || (filteredItems.length === 1 ? filteredItems[0].onClick : null);
|
||||
|
||||
clickAction?.();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user