From ae40a25f203ba897067f0c5097829eca90982891 Mon Sep 17 00:00:00 2001
From: Andrei Ivnitskii <18397-ivnish@users.noreply.drupalcode.org>
Date: Sat, 5 Apr 2025 10:04:23 +0000
Subject: [PATCH] Fix inline links

---
 flag.module | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/flag.module b/flag.module
index b278591a..d82c105c 100644
--- a/flag.module
+++ b/flag.module
@@ -453,6 +453,12 @@ function flag_entity_view_alter(&$build, EntityInterface $entity, EntityViewDisp
       $build['#contextual_links'][$entity_type]['metadata']['flag_keys'] = implode(',', $flag_keys);
     }
   }
+
+  // Enable placeholder on entity links to avoid them being cached with the
+  // entity view mode.
+  if (isset($build['links']['#lazy_builder'])) {
+    $build['links']['#create_placeholder'] = TRUE;
+  }
 }
 
 /**
-- 
GitLab