-
Notifications
You must be signed in to change notification settings - Fork 214
[bug] Uncaught TypeError: Cannot assign to read only property 'chosen' of object '#<Object>' since upgrade to v6.1.0 #228
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
Comments
Update: |
It's the only feature added in 6.1 |
Still don't know why but things work fine after I made this change: |
I think it is because if you destructure the object, even if it was frozen by immer or something like that, will send a copy that can be modified. From what I saw the object is being mutated here: // make all state false because we can't change sortable unless a mouse gesture is made.
const newList = [...props.list].map(item => Object.assign(item, {
chosen: false,
selected: false
})); If I for example would make a shallow copy of item like this it wouldn't modify the original frozen object: const newList = [...props.list].map(item => Object.assign({...item}, {
chosen: false,
selected: false
})); What do you think about updating this method here? |
Any fix for this yet? |
Describe the bug
After upgrate the react-sortablejs version from 6.0.3 to 6.1.0, I got this error everytime I click on my sortable list:
To Reproduce
Steps to reproduce the behavior:
pnpm install
,pnpm dev
andpnpm doc
in rootExpected behavior
Just work normally as v6.0.3
Information
Uncaught TypeError: Cannot assign to read only property 'chosen' of object '#'
Versions - Look in your
package.json
for this information:react-sortable = ^6.0.3
react = ^x.x.x
Additional context
I use nested sortable list.
The text was updated successfully, but these errors were encountered: