First , sorry for multiple posting.. I know livewire team is too busy.
I used Laravel Framework : 8.64.0 / livewire/livewire : 2.6.7 .
I made video for showing this bug. Please go Check it first.
https://streamable.com/tsg57n
I made simple project which follows https://laravel-livewire.com/docs/2.x/pagination.
I made PostComponent / CommentComponent , and put two component on welcome page together.
in welcome.blade.php
<div class="grid grid-cols-2 gap-1" >
<div>
@livewire('post-component')
</div>
<div>
@livewire('comment-component')
</div>
</div>
PostComponent.php
class PostComponent extends Component
{
use WithPagination;
public function render()
{
return view('livewire.post-component', [
'posts'=> Post::paginate(),
]);
}
}
post-component.blade.php
<div>
<div class="font-bold text-lg"> Post-Component</div>
<div > page : <span class="text-red-500 ">{{ $page }} </span></div>
<hr class="h-4 "/>
@foreach ($posts as $item)
<div class="">
post : {{ $item->id }}:
</div>
@endforeach
<div>
{{ $posts->onEachSide(1)->links() }}
</div>
</div>
CommentComponent.php
class CommentComponent extends Component
{
use WithPagination;
public $commentsPage;
public function render()
{
return view('livewire.comment-component', [
'comments' => Comment::paginate(10, ['*'], 'commentsPage'),
]);
}
}
comment-component.blade.php
<div>
<div class="font-bold text-lg"> Comment-Component</div>
<div > commentsPage : <span class="text-indigo-500 ">{{ $commentsPage }} </span></div>
<hr class="h-4 "/>
@foreach ($comments as $item)
<div class="">
{{ $item->id }} : comment :
</div>
@endforeach
<div>
{{ $comments->onEachSide(1)->links() }}
</div>
</div>
'commentsPage' pagination property does not as I expected.
Could someone check this bug ?