react-admin
react-admin copied to clipboard
Infinite loop occurs in page rendering when perPage is set to a negative number in List Component
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):
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.
I can't either reproduce. Please, provide a reproductible example using the React-admin v4 StackBlitz template. Of course, a PR is welcome :+1:
No news for some time, closing.