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

mehdi79's avatar

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.

0 likes
6 replies
Snapey's avatar

You don't have a $model attribute on your component?

mehdi79's avatar

@Snapey I have, but i created this component and table just for testing

mehdi79's avatar

So Silly, there was a mistake in my codes in Table Blade file,

This should be changed:

@foreach($model_permissions as $model)
     <x-tables.elements.authentication.database.model-group-row :key="$model->id" :$model/>
@endforeach

to this:

@foreach($model_permissions as $model)
    <x-tables.elements.authentication.database.model-group-row :key="{{$model->id}}" :$model/>
 @endforeach

I missed {{ ... }} for PHP variable in Blade !

Snapey's avatar

@mehdi79 how can anyone help if you don't show the actual code. I will probably pass on your questions in future

mehdi79's avatar

@Snapey it's actually in my question but only variables name are different, i edited

Snapey's avatar

@mehdi79 so now I look stupid as well. It said $user in the component and now it says $model

Please or to participate in this conversation.