Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-06-24 00:34:49 +0300
committerStan Hu <stanhu@gmail.com>2019-06-24 00:38:44 +0300
commit5fbd0ff460ec982cce570266f53176a8cf071326 (patch)
tree5e3dfe1868f8b2de7ff8e18899fd25ab8dd25096 /app/helpers/appearances_helper.rb
parentf89a33c9d13db824bb4f4618512d82b6c4e6515a (diff)
Memoize non-existent custom appearances
This saves about 5 SQL calls per page if no custom appearance is specified.
Diffstat (limited to 'app/helpers/appearances_helper.rb')
-rw-r--r--app/helpers/appearances_helper.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/helpers/appearances_helper.rb b/app/helpers/appearances_helper.rb
index c0db9910143..6b43d52c775 100644
--- a/app/helpers/appearances_helper.rb
+++ b/app/helpers/appearances_helper.rb
@@ -2,6 +2,7 @@
module AppearancesHelper
include MarkupHelper
+ include Gitlab::Utils::StrongMemoize
def brand_title
current_appearance&.title.presence || default_brand_title
@@ -25,7 +26,9 @@ module AppearancesHelper
end
def current_appearance
- @appearance ||= Appearance.current
+ strong_memoize(:current_appearance) do
+ Appearance.current
+ end
end
def brand_header_logo