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
17.6k stars 2.75k forks source link

[2.x] Bulk Action Modals conflict with multiple tables #754

Closed mrgla55 closed 2 years ago

mrgla55 commented 2 years ago

Package

filament/tables

Package Version

v2.4.56

Laravel Version

v8.74

Livewire Version

v2.8

PHP Version

PHP 8.0.0

Bug description

I have 2 separate filament tables showing within the 1 view. They both work in isolation, but the bulk action confirmation modals are conflicted. When performing a bulk action on one table, it looks like confirmation modal from both tables open. Then when the first modal is closed, the second modal is still appearing (with no content).

Looks like the issue is related to the non unique "id" of the modal being the same for both tables. <x-tables::modal id="bulk-action" display-classes="block">

The event dispatch would fire for both

  $this->dispatchBrowserEvent('open-modal', [
            'id' => 'bulk-action',
        ]);

Steps to reproduce

Within a single view, I have 2 filament table components

    <div>
        <livewire:teams-table-component />
        <livewire:assets-table-component />
    </div>

Relevant log output

No response

danharrin commented 2 years ago

As a temporary workaround, please use different names for your bulk actions, until we get this fixed.

I'm thinking - should we prefix the class name before the id? It would work, unless people have two of the same table on the same page, but this is probably quite unlikely.

danharrin commented 2 years ago

Should be fixed in #928.