From 58a7cd7efabac1e37d12f8da4c4bc62100fbc047 Mon Sep 17 00:00:00 2001
From: Ioannis Igoumenos <ioigoume@gmail.com>
Date: Mon, 11 Mar 2024 06:55:23 +0200
Subject: [PATCH] Do not reset the primaryLink if already set.

---
 app/src/Controller/StandardController.php | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/app/src/Controller/StandardController.php b/app/src/Controller/StandardController.php
index 808f6214b..b4883090d 100644
--- a/app/src/Controller/StandardController.php
+++ b/app/src/Controller/StandardController.php
@@ -108,8 +108,10 @@ public function add() {
     $this->set('vv_obj', $obj);
     
     // PrimaryLinkTrait, via AppController
-    $this->getPrimaryLink();
-    
+    // Check if I have already calculated it up the tree of execution
+    if(empty($this->cur_pl->value) && empty($this->cur_pl->attr)) {
+      $this->getPrimaryLink();
+    }
     // AutoViewVarsTrait, via AppController
     $this->populateAutoViewVars();