Livewire component has 'undefined variable' after updating Livewire?

I've setup a FormField as Livewire component in the a testing app using Filament 3 and Livewire 3: Component:
<?php

namespace App\Forms\Components;

use Filament\Forms\Components\Field;

class RangeSlider extends Field
{
protected string $view = 'forms.components.range-slider';

public string $testVar = 'testValue';
}
<?php

namespace App\Forms\Components;

use Filament\Forms\Components\Field;

class RangeSlider extends Field
{
protected string $view = 'forms.components.range-slider';

public string $testVar = 'testValue';
}
View:
<x-dynamic-component
:component="$getFieldWrapperView()"
:field="$field"
>
Value is: {{ $testVar }}

<div x-data="{ state: $wire.entangle('{{ $getStatePath() }}') }">
<!-- Interact with the `state` property in Alpine.js -->
</div>
</x-dynamic-component>
<x-dynamic-component
:component="$getFieldWrapperView()"
:field="$field"
>
Value is: {{ $testVar }}

<div x-data="{ state: $wire.entangle('{{ $getStatePath() }}') }">
<!-- Interact with the `state` property in Alpine.js -->
</div>
</x-dynamic-component>
Now where it says 'value is' it correctly echoed the value of my $testVar, but after updating via Composer it now throws an error Undefined variable $testVar Is there any way to mitigate this? Composer:
composer update -W
...
- Upgrading livewire/livewire (v3.0.0-beta.6 => v3.0.0-beta.7): Extracting archive
- Upgrading filament/support (v3.0.6 => v3.0.7): Extracting archive
- Upgrading filament/widgets (v3.0.6 => v3.0.7): Extracting archive
- Upgrading filament/actions (v3.0.6 => v3.0.7): Extracting archive
- Upgrading filament/notifications (v3.0.6 => v3.0.7): Extracting archive
- Upgrading filament/infolists (v3.0.6 => v3.0.7): Extracting archive
- Upgrading filament/forms (v3.0.6 => v3.0.7): Extracting archive
- Upgrading filament/tables (v3.0.6 => v3.0.7): Extracting archive
- Upgrading filament/filament (v3.0.6 => v3.0.7): Extracting archive
- Upgrading guzzlehttp/psr7 (2.5.0 => 2.6.0): Extracting archive
- Upgrading guzzlehttp/promises (2.0.0 => 2.0.1): Extracting archive
- Upgrading phpunit/phpunit (10.2.7 => 10.3.1): Extracting archive
composer update -W
...
- Upgrading livewire/livewire (v3.0.0-beta.6 => v3.0.0-beta.7): Extracting archive
- Upgrading filament/support (v3.0.6 => v3.0.7): Extracting archive
- Upgrading filament/widgets (v3.0.6 => v3.0.7): Extracting archive
- Upgrading filament/actions (v3.0.6 => v3.0.7): Extracting archive
- Upgrading filament/notifications (v3.0.6 => v3.0.7): Extracting archive
- Upgrading filament/infolists (v3.0.6 => v3.0.7): Extracting archive
- Upgrading filament/forms (v3.0.6 => v3.0.7): Extracting archive
- Upgrading filament/tables (v3.0.6 => v3.0.7): Extracting archive
- Upgrading filament/filament (v3.0.6 => v3.0.7): Extracting archive
- Upgrading guzzlehttp/psr7 (2.5.0 => 2.6.0): Extracting archive
- Upgrading guzzlehttp/promises (2.0.0 => 2.0.1): Extracting archive
- Upgrading phpunit/phpunit (10.2.7 => 10.3.1): Extracting archive
Solution:
GitHub
Custom form field throws ErrorException 'Undefined variable' on cus...
Package filament/forms Package Version v3.0.7 Laravel Version 10.17.1 Livewire Version dev-main 6e529b7 PHP Version PHP 8.2.0 Problem description Created a custom Form Field as described in the doc...
Jump to solution
3 Replies
jelmerkeij
jelmerkeijOP2y ago
Putting this in composer.json seems to revert back to a working version:
"require": {
...
"filament/filament": "v3.0.6",
...
}
"require": {
...
"filament/filament": "v3.0.6",
...
}
jelmerkeij
jelmerkeijOP2y ago
I've created a Github issue for this: https://github.com/filamentphp/filament/issues/7509
GitHub
Custom form field throws ErrorException 'Undefined variable' on cus...
Package filament/forms Package Version v3.0.7 Laravel Version 10.17.1 Livewire Version dev-main 6e529b7 PHP Version PHP 8.2.0 Problem description Created a custom Form Field as described in the doc...
Solution
petrisorcraciun
GitHub
Custom form field throws ErrorException 'Undefined variable' on cus...
Package filament/forms Package Version v3.0.7 Laravel Version 10.17.1 Livewire Version dev-main 6e529b7 PHP Version PHP 8.2.0 Problem description Created a custom Form Field as described in the doc...

Did you find this page helpful?