Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with wire:navigate #13

Open
QualityCodeSA opened this issue Jan 16, 2024 · 12 comments
Open

Not working with wire:navigate #13

QualityCodeSA opened this issue Jan 16, 2024 · 12 comments

Comments

@QualityCodeSA
Copy link

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
Copy link
Owner

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

@QualityCodeSA
Copy link
Author

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
Copy link
Owner

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

@QualityCodeSA
Copy link
Author

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

@aliqasemzadeh
Copy link
Owner

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

@aliqasemzadeh
Copy link
Owner

@QualityCodeSA
Trait doesn't work.

@QualityCodeSA
Copy link
Author

@aliqasemzadeh any possibility to work or not?

@aliqasemzadeh
Copy link
Owner

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

@mozhuilungdsuo
Copy link
Contributor

mozhuilungdsuo commented Jan 27, 2024

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

<livewire-modals

@endpersist
@aliqasemzadeh @QualityCodeSA

@aliqasemzadeh
Copy link
Owner

@mozhuilungdsuo
Please give us example.

@mozhuilungdsuo
Copy link
Contributor

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') <livewire:modals/> @endpersist
I maybe wrong but this should ideally fix it.

@hozzaq
Copy link

hozzaq commented Apr 25, 2024

@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(); } });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants