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

alex32's avatar
Level 2

Livewire | $refresh doesn't work

My livewire component works fine when the page loads, then I add a new menu via ajax call, but when I click on the refresh button, the component doesn't refresh and I've to reload the page to see the changes. No error messages. Thanks

  • Laravel 11
  • Livewire 3
  • Vite 5 - I think the issue is here ***

resources\views\livewire\side-menu.blade.php

<div class="sidebar" >

     <button x-on:click="$wire.$refresh()" class="d-block btn btn-primary"  >Refresh </button>
          

I also tried:

<div class="sidebar" >

	<button wire:click="$refresh()" class="d-block btn btn-primary"  >Refresh </button>
          

sidemenu.blade.php

 <aside class="main-sidebar sidebar-dark-primary elevation-4" style="top: 0; bottom:0; position:fixed "> 
        <a href="/home" class="brand-link">        </a> 
        @livewire ("side-menu",[ .. ]); 
      </aside>
	  ...

https://livewire.laravel.com/docs/actions#refreshing-a-component

0 likes
5 replies
alex32's avatar
Level 2

" the component doesn't refresh and I've to reload the page to see the changes. No error messages." I think this issue may be related to Vite

1 like
alex32's avatar
alex32
OP
Best Answer
Level 2

Sorry my mistake. I found the issue in the Controller (blade) - the logic was wrong and the controller didn't get the new data from the table. Livewire $refresh works fine now. Thank you.

1 like

Please or to participate in this conversation.