Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paginate does not work #603

Closed
loranger opened this issue Sep 23, 2021 · 6 comments
Closed

Paginate does not work #603

loranger opened this issue Sep 23, 2021 · 6 comments
Labels
bug Something isn't working unconfirmed

Comments

@loranger
Copy link

Package

filament/filament

Package Version

1.10

Laravel Version

8.61.0

Livewire Version

No response

PHP Version

7.4.16

Bug description

My pagination does not work. The paginator displays the correct amount of pages, but clicking on a page refresh the first one only.

I thought my tables where messed up but the issue is behave the same way on the default user list:

Enregistrement de l’écran 2021-09-23 à 17 59 29

Here is an ouput of telescope showing the last click of the gif: the page 7.

Capture d’écran 2021-09-23 à 18 00 47

The MySQL query does not seems to get the correct offset.

What may have caused this issue and how can I fix it ?

Steps to reproduce

No response

Relevant log output

No response

@loranger loranger added bug Something isn't working unconfirmed labels Sep 23, 2021
@danharrin
Copy link
Member

What is your Livewire version?

@loranger
Copy link
Author

Sorry I did not fill the version because it's the one shipped with filament.
It seems it's 2.2

@danharrin
Copy link
Member

Interesting. Can you create a brand new project and see if the issue is there too? I've never hit this.

@loranger
Copy link
Author

loranger commented Sep 23, 2021

I've just create a brand new project and the result is the same.

Here is what I have done:

  • Create project using composer create-project --prefer-dist laravel/laravel
  • Adjust .env variables for docker
  • Setup and start a docker-compose file (nginx, php-fpm:latest, mariadb:latest)
  • Install filament
    • composer require filament/filament
    • add FILAMENT_AUTH_GUARD=web to .env file
    • prepare User Model (adding traits and make all users filament admin)
    • add ignoreMigrations() to AppServiceProvider
  • Prepare seeding 100 users with factory
  • Migrate (artisan migrate --seed)
  • Create my user account (artisan make:filament-user)
  • Restart container to use the latest .env variables
  • Log in /admin, click on paginator. Datas refreshed, but always the same first page.

We could imagine the issue comes from the nginx or fpm setup, but even deployed on a bare server, the behaviour is the same.
However, I can provide the whole new project with the docker files if you wish.

@NeroAzure
Copy link

I faced the same issues a few days ago, and was thinking about making a pr. The issue here is the 2.6 update of Livewire (which should be installed here), they changed the pagination code to support multiple paginations, they now use an array with the paginations name to handle the page number.

Changing the setPage function in this package to include the array, fixed it for me:

public function setPage($page)
{
    $this->page = $page;
    $this->paginators['page'] = $page; // this line here

    $this->selected = [];
}

@danharrin
Copy link
Member

I'll bump the minimum Livewire version to v2.6 and PR that fix. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed
Projects
None yet
Development

No branches or pull requests

3 participants