Exception with Filament 3: Property type not supported in Livewire

Hello everyone, I hope you all are doing well. I'm currently facing an issue with Filament after an upgrade and I hope to get some help or pointers on how to solve it. I've been using the package Spatie Laravel Model States to cast attributes to a state class without any issues in Filament v2. However, after upgrading, any attribute that is cast to a class causes the following exception:
Exception
PHP 8.2.8
10.17.1
Property type not supported in Livewire for property: ["in_progress"]
Exception
PHP 8.2.8
10.17.1
Property type not supported in Livewire for property: ["in_progress"]
This didn't occur with the previous version of Filament and has been causing some roadblocks in my development process. Does anyone have an idea on what could be causing this and how to fix it? Any guidance or suggestions would be much appreciated. Thank you in advance.
GitHub
GitHub - spatie/laravel-model-states: State support for models
State support for models. Contribute to spatie/laravel-model-states development by creating an account on GitHub.
Solution:
Looking at the package docs, in their Payment example, I think having the PaymentState implement Wireable to set/get the underlying value with toLivewire and fromLivewire would work.
Jump to solution
7 Replies
Cosme fulanito
Cosme fulanitoOP16mo ago
For more context, this only happens in the EditRecord and ViewRecord classes
cheesegrits
cheesegrits16mo ago
Sounds like you may need to make those classes "wireable", with to/fromLivewire methods for serializing / unserializing the underlying data. LW3 limits the types it natively supports as properties, and anything else you want to use needs to be "wireable". https://livewire.laravel.com/docs/properties#supported-property-types
Laravel
Properties | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
cheesegrits
cheesegrits16mo ago
Ultimately, Spatie might be able to take care of it with a synthesizer, although I don't know enough about the Model States package to know if that would be possible. But until they address compatibility with LW3, handling it by making your classes wireable is probably the only solution.
awcodes
awcodes16mo ago
Yea, this has to be an issue in the Spatie Package. It's weird that the property name is an array.
Solution
cheesegrits
cheesegrits16mo ago
Looking at the package docs, in their Payment example, I think having the PaymentState implement Wireable to set/get the underlying value with toLivewire and fromLivewire would work.
cheesegrits
cheesegrits16mo ago
Ideally this would be done in Spatie's State class, but rolling your own would work for now, till they update their code for LW3.
Cosme fulanito
Cosme fulanitoOP16mo ago
@Hugh Messenger, thank you. Implementing Wireable worked, good catch! Thanks again.
Want results from more Discord servers?
Add your server