Form with fields that have ->reactive and afterStateUpdated

Hello, I've just made a comparison between a code running in a v3 form and same code running in v4 form. Results are kinda disapointing While in v3 my fields hide/show instantly in v4, it takes about 1-2 seconds to hide/show Was there any big change made on v4 in matter of forms?
6 Replies
toeknee
toeknee2mo ago
Filament
What's new in Filament v4? - Feature Overview by Leandro Ferreira -...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
toeknee
toeknee2mo ago
I would also look at your network requests though, you may have more functions or queries depending on your integration.
jamesro
jamesroOP2mo ago
you mean that in v4 using ->visible() and ->afterStateUpdate() are now slower, and I should use visibleJs and afterStateUpdateJs instead?
arichard123
arichard1232mo ago
If you can you should. If the logic is just based on the state data in the schema, then yes, do that. If you have to do a lookup to the database, or an api call, then that won't work, of course.
jamesro
jamesroOP2mo ago
thanks, i have a repeater, with such dependant fields, but it's odd, if i put a field in my repeater like
TextInput::make('pause')
->visibleJs(<<<'JS'
!['we','sr','in','bo','cfccm','ma','cc','fp','sc','bp','ne','oc','om','va','le','rm','cp','co'].includes($get('tip'))
JS)
->extraAttributes(['class' => 'inactivated'])
->readOnly()
->required()
->maxLength(15),
TextInput::make('pause')
->visibleJs(<<<'JS'
!['we','sr','in','bo','cfccm','ma','cc','fp','sc','bp','ne','oc','om','va','le','rm','cp','co'].includes($get('tip'))
JS)
->extraAttributes(['class' => 'inactivated'])
->readOnly()
->required()
->maxLength(15),
they won't be hidden if i change my tip field value, it works instead if i wrap my field inside a Grid::make()->schema([])->visibleJs(<<<'JS' !['we','sr','in','bo','cfccm','ma','cc','fp','sc','bp','ne','oc','om','va','le','rm','cp','co'].includes($get('tip')) JS) could this be a bug in filament v4?
toeknee
toeknee2mo ago
Can you console log the get? is it the same. wondering if it's not registering and could be a bug if it works on a sub instance

Did you find this page helpful?