Skip to content

[bug] Uncaught TypeError: Cannot assign to read only property 'chosen' of object '#<Object>' when using 6.0.4 with immutable data #237

@julienben

Description

@julienben

Hi!

Everything works fine for me in v6.0.3 but as soon as I use 6.0.4 or above, I get the error mentioned above.

I've tried 6.1.x as well but the issue is still present. It seems to be due to the changes made in this commit: 362cbd5

Spreading (as done in 6.0.3) seems to work fine but Object.assign won't work.

Note:

  • My data is from immer so that could be related.
  • It seems kind of strange that react-sortable (or sortable?) is adding extra keys to the list of objects passed into the props. It feels like it could create bugs easily.

To Reproduce
Steps to reproduce the behavior:

  1. I don't have a public repo to share but it's the exact same issue described in [bug] Uncaught TypeError: Cannot assign to read only property 'chosen' of object '#<Object>' since upgrade to v6.1.0 #228. The solution described there didn't work for me.

Expected behavior
For Sortable to work beautifully just like in 6.0.3 ;)

Information
This is required. Issues without this critical information will be closed.

Versions - Look in your package.json for this information:
react-sortable = 6.0.4
react = 17.0.2

Additional context
I'm doing nesting and it works flawlessly 🤷‍♂️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions