diff --git a/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts b/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts index f1039df07..f55ed340e 100644 --- a/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts +++ b/projects/netgrif-components-core/src/lib/navigation/navigation-double-drawer/service/double-drawer-navigation.service.ts @@ -253,6 +253,7 @@ export class DoubleDrawerNavigationService implements OnDestroy { * */ public onItemClick(item: NavigationItem): void { if (item.resource === undefined) { + this._currentNavigationItem = null; // custom view represented only in nae.json if (item.processUri === this.currentPath) { this._pathService.activePath = this.currentPath; @@ -261,6 +262,7 @@ export class DoubleDrawerNavigationService implements OnDestroy { } this.itemClicked.emit({path: this._pathService.activePath, isHome: false}); } else { + this._currentNavigationItem = item; const path = item.resource.immediateData.find(f => f.stringId === GroupNavigationConstants.ITEM_FIELD_ID_NODE_PATH)?.value if (DoubleDrawerUtils.hasItemChildren(item) && !this.leftLoading$.isActive && !this.rightLoading$.isActive) { @@ -285,13 +287,22 @@ export class DoubleDrawerNavigationService implements OnDestroy { /** - * Opens a view of the current right items in the menu by defined rule. The rule is: On first check for default - * view in children. On second check if the clicked item has a view. On third, pick any other children's view, else + * Opens a view of the current right items in the menu by defined rule. The rule is: First, it checks whether a navigation + * item was clicked. Second, check for default view in children. + * Third check if the clicked item has a view. Fourth, pick any other children's view, else * show nothing. * */ public openAvailableView() { let allItems: Array = this.rightItems.concat(this.moreItems); + if (this._currentNavigationItem) { + let alreadyClickedItem: NavigationItem = allItems.find(item => item.id === this._currentNavigationItem.id); + if (!!alreadyClickedItem) { + // when the folder has not changed and a menu item is clicked. + return; + } + } + let autoOpenItems: Array = allItems.filter(item => DoubleDrawerUtils.hasItemAutoOpenView(item)); if (autoOpenItems.length > 0) { this._redirectService.redirect(autoOpenItems[0].routing.path);