Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions src/Illuminate/View/DynamicComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ class DynamicComponent extends Component
*/
protected static $componentClasses = [];

/**
* The cached binding keys for component classes.
*
* @var array
*/
protected static $bindings = [];

/**
* Create a new component instance.
*
Expand Down Expand Up @@ -153,13 +146,9 @@ protected function classForComponent()
*/
protected function bindings(string $class)
{
if (! isset(static::$bindings[$class])) {
[$data, $attributes] = $this->compiler()->partitionDataAndAttributes($class, $this->attributes->getAttributes());

static::$bindings[$class] = array_keys($data->all());
}
[$data, $attributes] = $this->compiler()->partitionDataAndAttributes($class, $this->attributes->getAttributes());

return static::$bindings[$class];
return array_keys($data->all());
}

/**
Expand Down
13 changes: 13 additions & 0 deletions tests/Integration/View/BladeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ public function test_rendering_a_dynamic_component()
</div>', trim($view));
}

public function test_rendering_the_same_dynamic_component_with_different_attributes()
{
$view = View::make('varied-dynamic-calls')->render();

$this->assertEquals('<span class="text-medium">
Hello Taylor
</span>

<span >
Hello Samuel
</span>', trim($view));
}

protected function getEnvironmentSetUp($app)
{
$app['config']->set('view.paths', [__DIR__.'/templates']);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@props([
'name',
])

<span {{ $attributes }}>
Hello {{ $name }}
</span>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<x-dynamic-component component="hello-span" name="Taylor" class="text-medium" />
<x-dynamic-component component="hello-span" name="Samuel" />