react-admin icon indicating copy to clipboard operation
react-admin copied to clipboard

Infinite loop occurs in page rendering when perPage is set to a negative number in List Component

Open aoki-atsushi opened this issue 1 year ago • 2 comments

What you were expecting:

Even if a negative number is set in perPage, it is replaced by the default positive number.

What happened instead:

URL and List Component are rendered indefinitely

Steps to reproduce:

Access the page using ListComponent with the following query string ?page=1&perPage=-1

Related code:

Perhaps this is occurring because there is no logic to account for negative numbers in the following places https://github.com/marmelab/react-admin/blob/master/packages/ra-data-simple-rest/src/index.ts#L45-L46

Other information:

Environment

  • React-admin version: 4.16.13
  • Last version that did not exhibit the issue (if applicable):
  • React version: 18.2.0
  • Browser: Google Chrome
  • Stack trace (in case of a JS error):

aoki-atsushi avatar Mar 27 '24 09:03 aoki-atsushi

I can't reproduce it in the simple example StackBlitz. Perhaps it's because the problem is only in ra-data-simple-rest?

In any case, this is a minor bug for a corner case, so we won't prioritize it. Feel free to open a PR for it if the bug is more critical for your use case.

fzaninotto avatar Mar 28 '24 06:03 fzaninotto

I can't either reproduce. Please, provide a reproductible example using the React-admin v4 StackBlitz template. Of course, a PR is welcome :+1:

adguernier avatar Apr 05 '24 08:04 adguernier

No news for some time, closing.

fzaninotto avatar May 03 '24 19:05 fzaninotto