From b066ebf01001db596565ea30cfb33f060909748b Mon Sep 17 00:00:00 2001 From: Dave Wood Date: Tue, 28 Nov 2023 10:14:21 +0000 Subject: [PATCH] Generate a unique hash for anonymous components --- .../View/Compilers/Concerns/CompilesComponents.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php b/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php index 67b2d3beb0ca..8e986553abb1 100644 --- a/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php +++ b/src/Illuminate/View/Compilers/Concerns/CompilesComponents.php @@ -4,6 +4,7 @@ use Illuminate\Contracts\Support\CanBeEscapedWhenCastToString; use Illuminate\Support\Str; +use Illuminate\View\AnonymousComponent; use Illuminate\View\ComponentAttributeBag; trait CompilesComponents @@ -29,7 +30,9 @@ protected function compileComponent($expression) $component = trim($component, '\'"'); - $hash = static::newComponentHash($component); + $hash = static::newComponentHash( + $component === AnonymousComponent::class ? $component.':'.trim($alias, '\'"') : $component + ); if (Str::contains($component, ['::class', '\\'])) { return static::compileClassComponentOpening($component, $alias, $data, $hash);