filament icon indicating copy to clipboard operation
filament copied to clipboard

Unexpected behaviour with custom actions in nested actiongroups (Tables)

Open agruenberg opened this issue 1 year ago • 2 comments

Package

filament/tables

Package Version

v3.2

Laravel Version

v10.10

Livewire Version

v3.5.0

PHP Version

PHP 8.3.6

Problem description

Incorrect record is passed to custom action, if it is within a nested actiongroup.

This is the first execution of the custom action: image

After executing the action, the record will be passed to all other rows: image image

This occurs only, if the action is within a nested action group:

ActionGroup::make([
                    ActionGroup::make([
                        Tables\Actions\ViewAction::make(),
                        Tables\Actions\EditAction::make(),
                    ])->dropdown(false),
                    ActionGroup::make([
                        PublishMailAction::make()
                            ->visible(fn ($record) => !$record->is_published),
                        UnpublishMailAction::make()
                            ->visible(fn ($record) => $record->is_published),
                    ])->dropdown(false),

Expected behavior

Pass the correct record to the custom action

Steps to reproduce

  1. Put some custom actions into nested actiongroups
  2. Trigger one of the custom actions
  3. The record of the table row in which the action was triggered is now passed on to the other table rows if you trigger a custom action.

Reproduction repository

https://github.com/agruenberg/example-app

Relevant log output

No response

agruenberg avatar Jun 02 '24 21:06 agruenberg

Hey!

I'm stuck on this too, but it's happening in DeleteAction and EditAction too, not just custom actions. I tried the ->record method but seems that is not working (does not do anything).

Weird thing is that the "View" action on the video actually works, you can see that the IDs are those. Another weird thing is that on the Livewire DevTools, the mountedTableActionRecord it's correct, but is not reflecting it on the component.

I've been using filament for a while and with many other projects, and I've never seen this bug :/ don't know why is happening here, it's just a simple table.

PD: Ignore the ->model(Space::class) line, I was just testing it

https://github.com/user-attachments/assets/aeb6a9d9-581b-4188-926e-2a2402b7fda8

magarrent avatar Jul 30 '24 12:07 magarrent

Hey @polar-sh[bot]! We're sorry to hear that you've hit this issue. 💛

However, it looks like you forgot to fill in the reproduction repository URL. Can you edit your original post and then we'll look at your issue?

We need a public GitHub repository which contains a Laravel app with the minimal amount of Filament code to reproduce the problem. Please do not link to your actual project, what we need instead is a minimal reproduction in a fresh project without any unnecessary code. This means it doesn't matter if your real project is private / confidential, since we want a link to a separate, isolated reproduction. That would allow us to download it and review your bug much easier, so it can be fixed quicker. Please make sure to include a database seeder with everything we need to set the app up quickly.

github-actions[bot] avatar Mar 20 '25 17:03 github-actions[bot]

This appears to be fixed in v3 now

https://github.com/user-attachments/assets/89e53d2e-464e-4ece-a0bf-525b8b2205f7

danharrin avatar Jun 21 '25 13:06 danharrin