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

Livewire wire-navigate issue #2

Open
Arrig0 opened this issue Dec 5, 2024 · 1 comment
Open

Livewire wire-navigate issue #2

Arrig0 opened this issue Dec 5, 2024 · 1 comment

Comments

@Arrig0
Copy link

Arrig0 commented Dec 5, 2024

Hi.
Cool plugin, but i found out that navigating through Laravel Livewire wire:navigate, the teleportation, after a window resize, is performed as many times as the page (where the component is) has been navigated.

alpine-portal-issue-wire-navigate

@Arrig0
Copy link
Author

Arrig0 commented Dec 5, 2024

I found the solution.
I believe the issue is caused by a re-run of x-data when navigating through wire:navigate, so just remove the onResize listener when livewire is navigating (new HTML is about to swapped onto the page).

Just add this code in Portal.js before "window.Alpine.nextTick(() => this.onResize(mediaQuery));"
document.addEventListener('livewire:navigating', () => mediaQuery.removeEventListener('change', this.onResize));

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

1 participant