pinterest-for-woocommerce icon indicating copy to clipboard operation
pinterest-for-woocommerce copied to clipboard

Issues table pagination does not respect the page number and page size, and always return all issues

Open ecgan opened this issue 11 months ago • 0 comments

Describe the bug:

Related to issue https://github.com/woocommerce/pinterest-for-woocommerce/issues/882.

In the Issues table, I have pagination in the table footer like this:

image

There are issues with the pagination:

  • When I go to page 2, I noticed that the data is the same as page 1.
  • The "Rows per page" is set to 25, but there are 40 issues in the table.
  • This means 40 issues in page 1, and the same 40 issues in page 2.

Here's a screenshot of the API call:

image

From the client side, we pass paged and per_page parameters to the API.

However, on the server side, those parameters are not really used:

https://github.com/woocommerce/pinterest-for-woocommerce/blob/8251408b26fc5838f76b76518e2942efea8efa84/src/API/FeedIssues.php#L39-L74

Specifically, in the following line, we set the limit to be 250, instead of the per_page value:

https://github.com/woocommerce/pinterest-for-woocommerce/blob/8251408b26fc5838f76b76518e2942efea8efa84/src/API/FeedIssues.php#L59

I believe the above is the cause of issue.

Steps to reproduce:

  1. Go to Issues table in the Catalog page.
  2. Test pagination in the Issues table footer.

Expected behavior:

Pagination should work as expected.

Actual behavior:

The table will always show all data, regardless of how you set pagination.

ecgan avatar Mar 14 '24 13:03 ecgan