livewire modal closes after update
Is there a way to prevent a modal from automatically closing when the livewire content inside updates?
I have a calendar but when I change month, it closes the modal
Solution:Jump to solution
So I decided to just boycott the modal approach and added the widget directly to my View Page, make things easier
19 Replies
I don't think that should happen.
As in it already shouldn't be happening (some issue somewhere). Or my use case is wrong? 🤔
I don't think modal should close with Livewire updates.
Live forms work the same way.
So probably some issues with your specific case.
Thats actually a good point. Hm, something else must be the cause then yeah
Cheers
Maybe share some code?
So loading the calendar in the @livewire block
Just guessing, can it be related to the
wire.ignore
?
Can you share the calendar? Or is it too much?The calendar is just using guava plugin
THats all there is in it currently
And opening the content in an action modal
Hm, Widgets are just LW components, but maybe it's causing something else. Can you try with a simple LW component, that calls one of it's methods, just for testing?
I shall give it a go now
Did you register the widget on that Resource?
I dont believe so
You should register them via the
public static function getWidgets()
methodJust added that now, didnt make a difference?
As for the livewire test, I cant even get that to work
Unable to call component method. Public method [testClick] not found on component
The Action
Component
View:
I added this in the boot of my AppServiceProvider as well
Ah wait, test one works.
So I made a second view, that loads the livewire component with <livewire:component />
So Ill try that with the calendar approach
Nevermind, didnt fix it 🤣You are rendering just the Livewire view. Not the component.
Okay, what works, what didn't? 😅
Does the LW component work or does that close the modal, too?
the LW component worked.
I had the modal content call a view, that view called <livewire:test-component /> which had a button and a click, and the action of the click worked.
Okay, so it's not LW in a modal per se but must have something to do with either the widget or the specific implementation
Does ist maybe trigger a full reload?
Potentially, but no idea off the top of my head, Ill take a dig through the code
Lost in this package, gonna park it up and go on lunch
Solution
So I decided to just boycott the modal approach and added the widget directly to my View Page, make things easier