primereact
primereact copied to clipboard
InputNumber: value doesn't respect value state
Describe the bug
It seems that the value prop provided to <InputNumber/> isn't always correctly used.
The user can also think he's writing a value greater than the max value, because it's checked on blur.
The value can be outdated even after component blur.
Reproducer
https://codesandbox.io/p/sandbox/charming-sea-99c8lj?file=%2Fsrc%2Fdemo%2FInputNumberDemo.js%3A28%2C21
PrimeReact version
9.3.1
React version
17.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
- Select the input, its value should be 20 by default.
- Change value to 50.
- Click outside of the input. The value goes back to 30.
Expected behavior
- When trying to change the value, we shouldn't be able to write a value greater than
max. - The value in the input shouldn't change because its
valueprop is fixed.
I think this is similar to: https://github.com/primefaces/primereact/issues/5091