Action forms taking long time to load once clicked on

I am looking for some help i have a number of actions in a form that open a slideover form. They take a long time to open once clicked on. Forms\Components\Actions\Action::make('add_media') ->icon('heroicon-o-photo') ->badge(fn ($record) => is_array($record->media) ? count($record->media) : 0) ->form([ Forms\Components\FileUpload::make('media') ->disk('uploads') ->image() ->multiple() ->hiddenLabel(), ]) ->modalSubmitActionLabel('Add media') ->closeModalByClickingAway(false) ->action( function (Question $question, array $data) { $currentMedia = $question->media; foreach ($data['media'] as $media) { $currentMedia[] = $media; } $question->update([ 'media' => $currentMedia, ]); Notification::make() ->title(count($data['media']) . ' media filename added successfully') ->success() ->send(); } ) ->after(function (Question $question, Set $set) { $set('media', $question->media); }) ->slideover(),
3 Replies
Dennis Koch
Dennis Koch8mo ago
It's because you have a very large form and all that stuff gets rerendered and diffed by Laravel. Currently there is probably no way to improve this. V4 might solve this.
Michael Jones
Michael JonesOP8mo ago
Thank you for the reply. I was guessing the form size was something to do with it. Maby loading question by question in a custom livewire compoent like a quick would a way to get around it. When is V4 coming?
Dennis Koch
Dennis Koch8mo ago
Maby loading question by question in a custom livewire compoent like a quick would a way to get around it.
Yes. I guess moving this to a Livewire component would speed it up.
When is V4 coming?
We want to release this year.
Want results from more Discord servers?
Add your server