Shopmost
Shopmost copied to clipboard
[BUG] LIMIT must not be negative
Describe the bug
The filter that is situated on almost all the views in the Admin Panel does pop a blank page with the following error : LIMIT must not be negative, if you put a negative value, it's a small bug but still we need to catch every exception.
To Reproduce Steps to reproduce the behavior:
- Go to 'Admin Panel'
- Click on 'Categories or Products'
- Change the value in Show per page with a negative value '-1 for example'
- It should display : LIMIT must not be negative
Expected behavior
Normally when putting a negative value it should at least indicate with an alert that the value is not correct or just do nothing, but in this case it pops out on a blank page with the error below.
Background (please complete the following information):
NodeJS v16 Postgres v15 EverShop v1.0.0-rc.8 OS: Linux Ubuntu Focal Browser: Chrome
Solution
I have found a workaround by modifying the Pagination JSX with the following snippet on the onKeyPressLimit function :
const onKeyPressLimit = (e) => { .... if (limitNumber <= 0) { limitNumber = 1; } .... }; It works fine