wire-elements / modal

Livewire component that provides you with a modal that supports multiple child modals while maintaining state.
MIT License
1.09k stars 129 forks source link

Wire:navigate breaks modals #376

Closed fullsendai closed 8 months ago

fullsendai commented 8 months ago

Hi, thank you for your hard work! I'm having a problem in my app, if i wire:navigate to a page submit modal crud, i get errors like this.. Uncaught ReferenceError: show is not defined at [Alpine] show && showActiveComponent (eval at safeAsyncFunction (livewire.js?id=2f6e5d4d:1281:21), :3:32)

any help would be appreciated!

thermiteplasma commented 8 months ago

Hi,

I had this same issue. I'm not sure if this is the correct approach but I found if I wrapped @persist around

@livewire('wire-elements-modal')

in the layout file the error went away.

See docs here:

https://livewire.laravel.com/docs/navigate#persisting-elements-across-page-visits

fullsendai commented 8 months ago

Hi,

I had this same issue. I'm not sure if this is the correct approach but I found if I wrapped @persist around

@livewire('wire-elements-modal')

in the layout file the error went away.

See docs here:

https://livewire.laravel.com/docs/navigate#persisting-elements-across-page-visits

Much appreciation to your quick reply, will try now and let you know!

fullsendai commented 8 months ago

Much love brother, it actually worked.