You don't have a $model attribute on your component?
Apr 16, 2024
6
Level 1
Error when paginating or searching in table of nested Livewire row components
I have a table , It's a named Livewire component , inside it I use another named component in loop for each of my table. At this time I can not paginate more than only 1 time Livewire show errors at console:
Uncaught Snapshot missing on Livewire component with id: DVuxu9Q0wY6RAPgxfc1C
Also watch this video : pagination doesn't render rows and pagination buttons are disabled, when refreshing page it renders rows.
Table Component:
namespace App\Livewire\Tables\Authentication\Database;
use Livewire\Component;
use Livewire\WithPagination;
use App\Models\model_permission;
class DatabaseAuthTable extends Component
{
use WithPagination;
public function render()
{
return view('livewire.tables.authentication.database.database-auth-table', [
'model_permissions' => model_permission::paginate(5),
]);
}
}
Table Blade:
@foreach($model_permissions as $model)
<livewire:tables.authentication.database.model-group-row wire:key="$model->id" :$model />
@endforeach
Row Component:
namespace App\Livewire\Tables\Authentication\Database;
use Livewire\Component;
class ModelGroupRow extends Component
{
public $model;
public function render()
{
return view('livewire.tables.authentication.database.model-group-row');
}
}
Row Blade:
<div wire:key="$model->id">
<tr class="border hover:bg-gray-100/40 text-sm">
<td class="py-4 px-1 text-center">
<input wire:model.live="selectedModelIds" value="" type="checkbox" class="rounded p-2 shadow">
</td>
<td class="py-4 px-2">
mobile
</td> ...
</tr>
</div>
The problem is only when using name component for rows, when using anonymous component there is no error.
Please or to participate in this conversation.