Allowed memory exhausted while using fn($record) in hintAction

Hello, On my basket editing page, I can see the customer (but aI can not change the customer) and would like to add a button to edit the customer's information in a modal on the same page. I am using hintAction :
->hintAction(
EditAction::make('updateCustomer')
->record(fn($record) => $record->customer) // When I use "$record", I get "Allowed memory size of 2147483648 bytes exhausted, at Concerns\\EvaluatesClosures.php:32"
// ->record(fn() => Customer::first()) // I do not get any error with this line.
->schema(CustomerForm::configure(\Filament\Schemas\Schema::make())->getComponents())
)
->hintAction(
EditAction::make('updateCustomer')
->record(fn($record) => $record->customer) // When I use "$record", I get "Allowed memory size of 2147483648 bytes exhausted, at Concerns\\EvaluatesClosures.php:32"
// ->record(fn() => Customer::first()) // I do not get any error with this line.
->schema(CustomerForm::configure(\Filament\Schemas\Schema::make())->getComponents())
)
Do you know if there is another solution, or a way to fix it? Thanks!
3 Replies
Dennis Koch
Dennis Koch3d ago
Does this only happen with Filament or on any Laravel route? Maybe you have a circular dependency.
bouly
boulyOP3d ago
It happens using filament default behavior. I have a custom scope file that could generate a circular dependancy but I commented it and still got this error...
Matthew
Matthew2d ago
Check this works: ->hintAction( EditAction::make('updateCustomer') ->record(function($record) => { dd($record); }) ->schema(CustomerForm::configure(\Filament\Schemas\Schema::make())->getComponents()) ) Then check: ->hintAction( EditAction::make('updateCustomer') ->record(function($record) => { dd($record->customer); }) ->schema(CustomerForm::configure(\Filament\Schemas\Schema::make())->getComponents()) )

Did you find this page helpful?