aliqasemzadeh / livewire-bootstrap-modal

Dynamic Laravel Livewire Bootstrap modals.
35 stars 12 forks source link

Not working with wire:navigate #13

Open QualityCodeSA opened 5 months ago

QualityCodeSA commented 5 months ago

Bootstrapt modal working fine when first time open page with refresh but in livewire 3 not working when come back from other page (usinf wire:navigate) and open modal

aliqasemzadeh commented 5 months ago

yes, I know some problem and I am working hard on it.

QualityCodeSA commented 5 months ago

yes, I know some problem and I am working hard on it.

Thank you brother. Update me once finish so I will apply changes

aliqasemzadeh commented 5 months ago

Check note and update. I hope this update help me and then let me know.

QualityCodeSA commented 5 months ago

@aliqasemzadeh any update regarding not working with wire:navigate ?

aliqasemzadeh commented 5 months ago

@QualityCodeSA No it doesn't work. I think we need trait to dispatch modals to solve this problem.

aliqasemzadeh commented 5 months ago

@QualityCodeSA Trait doesn't work.

QualityCodeSA commented 5 months ago

@aliqasemzadeh any possibility to work or not?

aliqasemzadeh commented 5 months ago

@QualityCodeSA It looks like there is no solution a the moment.

mozhuilungdsuo commented 5 months ago

I think we need to persist the livewire modal? @persist('modals')

<livewire-modals

@endpersist @aliqasemzadeh @QualityCodeSA

aliqasemzadeh commented 5 months ago

@mozhuilungdsuo Please give us example.

mozhuilungdsuo commented 5 months ago

as per the documentation a <a href="/users" wire:navigate>Users</a> requests the page in the background and replaces the current page. So the livewire modal component ie <livewire:modals/> we put in the app layout view would show the old livewire component and since we added a new livewire component itll give issue ( thats what i assume). so as per the documentation herehttps://livewire.laravel.com/docs/navigate

we should be keeping this in the app layout view. ` @persist('player')

@endpersist` I maybe wrong but this should ideally fix it.

hozzaq commented 2 months ago

@mozhuilungdsuo yeah persist works, another issue i found is modal-backdrop not being created so the solution i found is to add event listener for livewire:navigated and dispose the old modal document.addEventListener("livewire:navigated", () => { let modal = Modal.getInstance(modalsElement); if (modal) { modal.dispose(); } });