Livewire V3 Call to undefined function Livewire\Concerns\data_forget()

651 views Asked by At

Please, I need help about this I use Laravel 10, Livewire version 3, when run in WSL2 at localhost, this code have no problem.

but if run in a production at linux serve ubuntu, i have this error: Call to undefined function Livewire\Concerns\data_forget() in this line:

   $this->reset('openModalAsign','usersWithRoles','user_id','rolId');

I tried clear cache, but the error persist

1

There are 1 answers

0
davidantoniovc On BEST ANSWER

I found the error! in Livewire V3 the $this->reset command only works if you declare its properties public at the beginning.

This is because the reset() command assigns these values.

Before

class Roles extends Component
{
   public openModalAsign;
   public usersWithRoles;
   public user_id;
   public rolId;
   ...
}

After

class Roles extends Component
{
   public openModalAsign = [];
   public usersWithRoles = [];
   public user_id = null;
   public rolId = null;
   ...
}