diff --git a/src/Fields/Blueprint.php b/src/Fields/Blueprint.php index 2927f3fff77..2e77a4ec8ee 100644 --- a/src/Fields/Blueprint.php +++ b/src/Fields/Blueprint.php @@ -42,6 +42,8 @@ class Blueprint implements Arrayable, ArrayAccess, Augmentable, QueryableValue protected $ensuredFields = []; protected $afterSaveCallbacks = []; protected $withEvents = true; + private $lastBlueprintHandle = null; + private ?Columns $columns = null; public function setHandle(string $handle) @@ -635,6 +637,16 @@ public function validateUniqueHandles() protected function resetFieldsCache() { + if ($this->parent) { + $blueprint = (fn () => property_exists($this, 'blueprint') ? $this->blueprint : null)->call($this->parent); + + if ($blueprint && $blueprint === $this->lastBlueprintHandle) { + return $this; + } + + $this->lastBlueprintHandle = $blueprint; + } + $this->fieldsCache = null; Blink::forget($this->contentsBlinkKey());