Persistent Livewire Modal State Issue with Multiple Header Actions
Environment:
* Filament Version:
3
* Laravel Version: 12
* PHP Version: 8.3
Problem Description:
I have a Filament table with two headerActions
: a default ExportAction
and a custom Action
that opens a modal with a file upload form.
When I click the first action (e.g., Export), its modal opens correctly. However, after closing it, if I click the second action (the custom one), the first action’s (Export) modal opens again instead of its own. The same happens in reverse.
What Has Been Tried (Diagnostics):
1. Unique Names: We ensured both actions had unique names using ->make('unique-name')
. The rendered HTML confirmed the wire:click
handlers were correct (mountTableAction('export')
and mountTableAction('searchSimilar')
), but the issue persisted.
2. Inline Action: To completely eliminate any conflict with the custom class, we rewrote the action directly inside the headerActions
array within the Resource file. The issue still occurs even with this setup.
29 Replies
The last time I clicked on "Exportar Peças" after refreshing the page, the correct modal was loaded. However, the issue reversed — now the "Buscar Similares" button is showing the same modal.
@MK | Programmer Were you able to solve this issue?
@stanwarri Not yet, I'm still waiting for a response.
I converted the actions into pages to solve the issue, as I couldn't get them to work properly as modals.
@MK | Programmer I'm currently experiencing this and haven't been able to figure out what is happening
Does this happen with any 2 actions that open a modal? Or just those specific ones?
@Dennis Koch In any resource where I add two or more actions, it does that.
That sounds weird.
Are you on the latest version? You just said your are on Filament v3.
If yes: Can you reproduce that with a fresh install of Filament?
In a fresh install of Filament, I don't have this issue.
But my project is already quite large and has been in development for months.
This started happening only recently, and I haven't done anything different that I can recall.
Did you overwrite any view files?
@Dennis Koch Yes, it happens when I have 2 or more modal actions, like in a relationship manager with default edit and delete actions. I upgraded to 3.3.31. 2 days ago, and started experiencing this. Even when I downgraded to previous versions, they issue still remains.
In my
composer.json
:
"filament/filament": "^3.2",
Did any of you overwrite view files?
No
Can you try running
artisan filament:upgrade
if you didn't already?I did that.
Wow, this just solved the problem. I need knew that the filament vendor files were pubished. Deleting those just solved the problem
Please never overwrite view files unless you know what you are doing and you absolutely have to. This will very likely cause issues with every upgrade.
What does
artisan about --only=filament
output?I know right. This can happen when working in a team. I will enforce policy on that
Thank @Dennis Koch for the pointer.
@Dennis Koch Thaank you!! My views were indeed published — someone from the project did it, and I'm investigating why. But after deleting them, it was fixed.
Great that we checked that 😅
Are you guys working on the same team? 😅
No
Would have been funny 😅
Yes, really lol 😄
Hahaha, I think this might be a general issue for people working in teams if not carefully checked.
Another lesson for me is that when working on a big project and some of these issues arises, we tend to solve it by trying to dig deeper when the solution might actually be simple. You sometimes need a third eye, or step away from the problem to realize what the solution would have been.
I'm truly humbled by this experience considering the fact that I have known about the implication of publishing view assets, and have guided against it in the past.
@stanwarri glad you were able to get this resolved - would you mind clarifying what you did exactly to remove the views? I cleared my vendor and re-installed, and deleted public/js/filament and public/css/filament but think I probably missed something described above. I also ran php artisan optimize:clear too - but i'm still seeing the same behavior.
@islandnuge You need to delete filament folder in the
resources/views/vendor
folder. That's what need to be deleted@stanwarri thank you so much - that issue has been on my list to resolve for over a month! You saved my bacon!
Why do so many people publish the view files 🙈
Btw: You could have saved yourself a lot of time if you'd read the "Read before posting" guide 😅
It's mentioned in "First Aid"
https://discord.com/channels/883083792112300104/1167015843020943390
i'm not sure when that happened in our project - appreciate the advice