-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prepending component attributes causes an exception when said attribute is missing in calling template #35128
Comments
I've hotfixed this locally by adding a <?php
namespace Illuminate\View;
class AppendableAttributeValue
{
/**
* The attribute value.
*
* @var mixed
*/
public $value;
/**
* Create a new appendable attribute value.
*
* @param mixed $value
* @return void
*/
public function __construct($value)
{
$this->value = $value;
}
public function __toString()
{
return (string)$this->value;
}
} Not sure how this affects other parts of the code though. |
Which example? |
@driesvints the one from the Non-class attribute merging section. I've provided it verbatim in my original post. |
Copy paste your |
It's just an empty default Component stub:
|
Thanks. I managed to reproduce this. I think the |
Sure, I'll link it here when it's ready. |
Fixed in #35131 |
Description:
Rendering a component with prepended attributes but without overriding that attribute in the calling template yields an error.
Steps To Reproduce:
composer create-project laravel/laravel testing
php artisan make:component TestComponent
Rendering this component like so:
<x-test-component data-controller="some-controller" />
works as expected.Rendering this component like so:
<x-test-component />
yields the following error:I would expect to have the string
profile-controller
to be the default and only value present if no attribute nameddata-controller
is specified.The text was updated successfully, but these errors were encountered: