Skip to content

Commit

Permalink
Generate a unique hash for anonymous components (#49156)
Browse files Browse the repository at this point in the history
  • Loading branch information
billyonecan authored Nov 28, 2023
1 parent 8ae12c9 commit 48c6e43
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Contracts\Support\CanBeEscapedWhenCastToString;
use Illuminate\Support\Str;
use Illuminate\View\AnonymousComponent;
use Illuminate\View\ComponentAttributeBag;

trait CompilesComponents
Expand All @@ -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);
Expand Down

0 comments on commit 48c6e43

Please sign in to comment.