Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ahmd_rmzn's avatar

Livewire3 experiences a full-page reload issue triggered by any action.

I'm encountering unexpected behavior with Livewire 3, wherein the page reloads entirely with every action, be it button clicks or form submissions. While it occasionally functions correctly, at other times, it results in full-page reloads. Here, I'm providing one example of my code, but this issue occurs with every action.

Any assistance would be greatly appreciated.

@foreach($this->tabsList as $tabKey => $tabValue)
             <button type="button" wire:click="setActiveTab('{{ $tabValue }}')">
                  {{ $tabKey }}
               </button>
@endforeach
public function setActiveTab(string $tab): void
    {
        $this->active_tab = $tab;
    }
0 likes
3 replies
LaryAI's avatar
Level 58

It sounds like you're experiencing issues with Livewire where actions that should be handled via AJAX are causing a full-page reload. Here are a few steps you can take to troubleshoot and resolve this issue:

  1. Check Livewire Scripts: Ensure that Livewire's JavaScript assets are properly included in your layout. They should be placed before the closing </body> tag and after any other scripts, like so:
...
@livewireScripts
</body>
  1. Check for JavaScript Errors: Open your browser's developer tools and check the console for any JavaScript errors. JavaScript errors can prevent Livewire from functioning correctly.

  2. Disable Turbolinks or pjax if used: If you're using Turbolinks, pjax, or any similar library that hijacks clicks to prevent full-page reloads, ensure that they are not interfering with Livewire. You might need to disable them or configure them to work with Livewire.

  3. Ensure Proper Livewire Directive Usage: Make sure you're using the correct Livewire directives. For example, wire:click should be used without JavaScript event modifiers like @click.

  4. Check Network Requests: When you click the button, check the network tab in your browser's developer tools to see if an XHR request is being made to the server. If you see a regular HTTP request instead of an XHR request, it means Livewire is not intercepting the click as it should.

  5. Livewire Component Hydration: Ensure that your Livewire component is not being dehydrated and rehydrated in a way that causes a full-page reload. This can happen if the component's state is not maintained between requests.

  6. Alpine.js Integration: If you're using Alpine.js alongside Livewire, ensure that you're using the correct version that is compatible with Livewire and that you're initializing Alpine.js after Livewire:

@livewireScripts
<script src="//unpkg.com/alpinejs" defer></script>
  1. Update Livewire: If you're not on the latest version of Livewire, consider updating to the latest version as it may contain bug fixes that resolve your issue.

  2. Clear Cache: Clear your application cache and your browser cache. Sometimes, stale cached assets can cause issues.

  3. Livewire Service Provider: Ensure that the Livewire service provider is registered in your config/app.php file under the providers array.

If none of these steps resolve the issue, you may want to provide more context or code examples on the forum for further assistance. It could be helpful to see how you're including Livewire components in your views and any other relevant JavaScript or Livewire code.

Snapey's avatar

bear in mind that Lary can only refer to Livewire 2.

Livewirescripts are not needed any more, however you should check your browser console for javascript errors.

Using Livewire just to switch tabs is not a great solution as a trip to the server and back is required for every tab click. I wrote up a solution using Alpine which would perform better https://talltips.novate.co.uk/tabbed-content-using-alpine-js and also incorporates a solution to open the right tab when handling a validation error for instance.

1 like

Please or to participate in this conversation.