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:
parent
be8e350510
commit
079976d703
@ -73,8 +73,9 @@ export class CatalogAddButton extends React.Component<CatalogAddButtonProps> {
|
|||||||
|
|
||||||
@boundMethod
|
@boundMethod
|
||||||
onButtonClick() {
|
onButtonClick() {
|
||||||
const defaultAction = this.menuItems.find(item => item.defaultAction)?.onClick;
|
const filteredItems = this.props.category ? this.props.category.filteredItems(this.menuItems) : [];
|
||||||
const clickAction = defaultAction || (this.menuItems.length === 1 ? this.menuItems[0].onClick : null);
|
const defaultAction = filteredItems.find(item => item.defaultAction)?.onClick;
|
||||||
|
const clickAction = defaultAction || (filteredItems.length === 1 ? filteredItems[0].onClick : null);
|
||||||
|
|
||||||
clickAction?.();
|
clickAction?.();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user