pagi icon indicating copy to clipboard operation
pagi copied to clipboard

Pagination Path Changes After Livewire Update

Open 0smr opened this issue 9 months ago • 2 comments

After a Livewire component re-renders, the pagination path changes to livewire/update/page/, which disrupts the functionality of pagination links.

The Pagi library uses get_pagenum_link, which relies on REQUEST_URI as the reference URL for the path.
To address this, I temporarily modified the REQUEST_URI as follows:

$tmp = $_SERVER['REQUEST_URI'];
$_SERVER['REQUEST_URI'] = $this->baseUrl;
$links = PagiFacade::build()->links();
$_SERVER['REQUEST_URI'] = $tmp;

Is there any other recommended solution to resolve this issue?

Thank you in advance

0smr avatar Feb 28 '25 21:02 0smr

That's an annoying issue 😦

Would it be possible to just filter get_pagenum_link? Otherwise, I don't see a sane solution outside of figuring out an alternative to it in Pagi. 🤔

Log1x avatar Feb 28 '25 21:02 Log1x

@aglipanci Actually, there is a get_pagenum_link filter. I will test to see if it works. Thanks.

0smr avatar Feb 28 '25 21:02 0smr