filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.41k stars 2.87k forks source link

Modal hidden / heading / description closures evaluated multiple times #11424

Closed binaryfire closed 7 months ago

binaryfire commented 8 months ago

Package

filament/filament

Package Version

v3.2.34

Laravel Version

v10.3.3

Livewire Version

v3.4.4

PHP Version

8.3

Problem description

The modalHidden(), modalHeading() and modalDescription() closures on actions are evaluated multiple times.

This causes all queries / notifications etc. used in these closures to be executed multiple times.

Expected behavior

These methods should only be evaluated once.

Steps to reproduce

Download reproduction repo, go to "Products" and click the "Modal test" header action. You'll see the notification being sent in each closure firing multiple times.

Reproduction repository

https://github.com/binaryfire/filament-reproduction-repo

Relevant log output

No response

danharrin commented 7 months ago

Removing the form() doesnt fix the problem on my end

binaryfire commented 7 months ago

@danharrin Confirmed. Must have been sleep deprived when I wrote that. I've updated the issue.

danharrin commented 7 months ago

Some of the calls can now be avoided if you inform Filament that the action explicitly has a modal (#11746).

The rest of the calls are due to a bug in Laravel's anonymous Blade component tag implementation. I am working on a Laravel PR, but fixing this in the Filament core would make the code messier, so I want to avoid that.

danharrin commented 7 months ago

https://github.com/laravel/framework/pull/50403