OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
avoid instantiating the notification menu twice for the header
ulfertse65ca0440085
diff --git a/app/components/notifications/index_page_header_component.rb b/app/components/notifications/index_page_header_component.rbindex d82bd0be5a2..87430ca55f4 100644--- a/app/components/notifications/index_page_header_component.rb+++ b/app/components/notifications/index_page_header_component.rb@@ -61,21 +61,26 @@ module Notificationsdef current_sectionreturn @current_section if defined?(@current_section)- @current_section = Notifications::Menu- .new(params:, current_user: User.current)+ @current_section = notifications_menu.selected_menu_groupenddef current_itemreturn @current_item if defined?(@current_item)- @current_item = Notifications::Menu- .new(params:, current_user: User.current)+ @current_item = notifications_menu.selected_menu_itemenddef first_menu_item?current_item&.href == notifications_pathend++ def notifications_menu+ # Instantiating the Notifications::Menu is currently costly as it fires+ # three database queries right away.+ @notifications_menu ||= Notifications::Menu+ .new(params:, current_user: User.current)+ endendend