-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OrderList: Behavior when using spread syntax in onChange #4089
Comments
I will try and diagnose what is going on here. Is it only with spread notation? Not if you use individual props? |
For example, if I keep sort numbers in my product list and I want to update only the other values without changing the sort numbers, I want to use the spread syntax.
|
@xabierun return dataKey ? ... : list.findIndex((item) => item === value); So you should passed dataKey like... <OrderList
dataKey="id"
value={products}
onChange={(e) => {
sortEventHandle(e);
}}
itemTemplate={itemTemplate}
header="Products"
></OrderList>; |
@melloware |
Lets update docs and make sure all showcase examples have a |
OK I updated all examples and switching dataKey to required in the TypeScript def. |
Describe the bug
Hello.
When updating state using spread syntax with the value of [event.value] passed when the onChange event of OrderList is fired, the following bug occurs.
Reproducer
https://codesandbox.io/s/primereact-demo-forked-i55nkl?file=/src/demo.js
PrimeReact version
8.3.0
React version
17.x
Language
TypeScript
Build / Runtime
Next.js
Browser(s)
No response
Steps to reproduce the behavior
Expected behavior
Ideally, no focus is lost and no undefined is stored in the array.
The text was updated successfully, but these errors were encountered: