From 04fc7c2f87372511b0f77e539bc0e2e3357ec200 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 5 Oct 2021 14:19:00 -0500 Subject: [PATCH] flush component state when done rendering --- src/Illuminate/View/Concerns/ManagesComponents.php | 11 +++++++++++ src/Illuminate/View/Factory.php | 1 + 2 files changed, 12 insertions(+) diff --git a/src/Illuminate/View/Concerns/ManagesComponents.php b/src/Illuminate/View/Concerns/ManagesComponents.php index 5e8bf68ce6e8..38834e4f8a4b 100644 --- a/src/Illuminate/View/Concerns/ManagesComponents.php +++ b/src/Illuminate/View/Concerns/ManagesComponents.php @@ -163,4 +163,15 @@ protected function currentComponent() { return count($this->componentStack) - 1; } + + /** + * Flush all of the component state. + * + * @return void + */ + protected function flushComponents() + { + $this->componentStack = []; + $this->componentData = []; + } } diff --git a/src/Illuminate/View/Factory.php b/src/Illuminate/View/Factory.php index cdb803f34d9f..eda479db8468 100755 --- a/src/Illuminate/View/Factory.php +++ b/src/Illuminate/View/Factory.php @@ -467,6 +467,7 @@ public function flushState() $this->flushSections(); $this->flushStacks(); + $this->flushComponents(); } /**