From 8d476c9bb14c81efc088d92c84a46e301b77bec9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Gaya?= <sebastien.gaya@gmail.com>
Date: Thu, 29 Dec 2022 16:00:01 +0100
Subject: [PATCH] permalink memoization

---
 app/models/communication/website/permalink.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/app/models/communication/website/permalink.rb b/app/models/communication/website/permalink.rb
index e26ce4c82..344e2b09c 100644
--- a/app/models/communication/website/permalink.rb
+++ b/app/models/communication/website/permalink.rb
@@ -82,8 +82,8 @@ class Communication::Website::Permalink < ApplicationRecord
   end
 
   def computed_path
-    return nil unless published?
-    @computed_path ||= Static.clean_path(published_path)
+    return @computed_path if defined?(@computed_path)
+    @computed_path ||= published? ? Static.clean_path(published_path) : nil
   end
 
   def save_if_needed
-- 
GitLab