File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
plugin-sql-generator/src/SqlGenerators Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -68,8 +68,18 @@ export const SubMenuElement = observer<ISubMenuElementProps>(function SubMenuEle
6868
6969 const handler = subMenuData . handler ;
7070
71- // TODO: it's better to remove this expensive check to allow lazy loading of menu items
72- const hidden = getComputed ( ( ) => subMenuData . items . every ( item => item . hidden ) || handler ?. isHidden ?.( subMenuData . context ) ) ;
71+ // NOTE: some menus rely on lazy loading. When items are not loaded yet `items` may be empty,
72+ // but the submenu still must be rendered to allow opening it and triggering loaders.
73+ const hidden = getComputed ( ( ) => {
74+ if ( handler ?. isHidden ?.( subMenuData . context ) ) {
75+ return true ;
76+ }
77+
78+ const hasVisibleItems = subMenuData . items . some ( item => ! item . hidden ) ;
79+ const canLazyLoadItems = subMenuData . loaders . length > 0 ;
80+
81+ return ! hasVisibleItems && ! canLazyLoadItems ;
82+ } ) ;
7383 const IconComponent = handler ?. iconComponent ?.( ) ?? subMenu . iconComponent ?.( ) ;
7484 const extraProps = handler ?. getExtraProps ?.( ) ?? ( subMenu . getExtraProps ?.( ) as any ) ;
7585 // TODO: fix, this triggers `Cannot update a component (`SubMenuElement`) while rendering a different component`
Original file line number Diff line number Diff line change 11/*
22 * CloudBeaver - Cloud Database Manager
3- * Copyright (C) 2020-2024 DBeaver Corp and others
3+ * Copyright (C) 2020-2025 DBeaver Corp and others
44 *
55 * Licensed under the Apache License, Version 2.0.
66 * you may not use this file except in compliance with the License.
You can’t perform that action at this time.
0 commit comments