JakeSidSmith / react-reorder

Drag & drop, touch enabled, reorderable / sortable list, React component
https://jakesidsmith.github.io/react-reorder/
MIT License
218 stars 58 forks source link

Error: Expected reorderId to be a string. Instead got undefined #91

Closed fhuyghe closed 6 years ago

fhuyghe commented 6 years ago

I'm running into this issue and didn't find any information about it in the documentation.

I tried a lot of different configurations with the same result. When I add reorderId='_id' to my list of props, I lose the warning and a div is created, but nothing is inside.

Reorder is added to my component this way: import Reorder from 'react-reorder'

And in the render:

<Reorder 
    itemKey='_id'
    lock='horizontal'
    holdTime={0}
    list={this.props.user.mylist}
    template={Listing}
    listClass='my-list'
    itemClass='list-item'
    callback={this.callback}
    listClass='my-list'
    itemClass='list-item'
    itemClicked={this.itemClicked}
    selected={this.state.selected}
    selectedKey='_id'
    disableReorder={false}
/>
CadiChris commented 6 years ago

I'm hitting the same issue. The only place where I've found reorderId is on the rework branch : https://github.com/JakeSidSmith/react-reorder/tree/rework

Current released version of the npm package is 3.0.0-alpha.2 so it's clearly OK for it to be unstable. My guess is that the npm release is linked to rework branch, but that we'd better install stable release. I'll try to install the latest stable release, and update this thread if this works.

JakeSidSmith commented 6 years ago

The config / markup has changed a lot for v3. Are you following the new readme?

https://github.com/JakeSidSmith/react-reorder/tree/rework#configuration

CadiChris commented 6 years ago

Oh right, that makes sense. I was using master branch README against v3 package. And think @13MS was doing the same.

I just yarn add react-reorder@2.2.1 and reorderId error is gone.

@JakeSidSmith : For production software, is it better to use v3 alpha, or 2.2.1 is currently more reliable ?

JakeSidSmith commented 6 years ago

Uhhh. Hard to say. Personally I'd go with v3, as if you are not using multiple lists (in v3 you can drag between lists) v3 has some bug fixes that are not in v2. Though there is a bug with the dragging between lists https://github.com/JakeSidSmith/react-reorder/issues/78#issuecomment-296424877.

CadiChris commented 6 years ago

OK, I'll give a shot at v3, thanks ! Are you interested in a PR on master's README pointing out that users of v3 should read the rework README? This could avoid potential frustration for future users :D

JakeSidSmith commented 6 years ago

Just sorted that: https://github.com/JakeSidSmith/react-reorder/blob/master/README.md

Great minds. 😛

JakeSidSmith commented 6 years ago

Note: if using a component class / stateless component you will need to manually pass down the reorder props: https://github.com/JakeSidSmith/react-reorder/issues/78#issuecomment-296593098

Will hopefully find a way to avoid this in the future. 😄

JakeSidSmith commented 6 years ago

Ignore what I said about the multi-list bug, forgot I had merged this: https://github.com/JakeSidSmith/react-reorder/pull/83

CadiChris commented 6 years ago

Just to confirm that v3 is working perfectly ! IMO this issue deserves to be Closed 🙂

JakeSidSmith commented 6 years ago

Will do. 😀

jorisw commented 6 years ago

Except that npm install react-reorder installs v3, while GitHub shows the v2 docs.

JakeSidSmith commented 6 years ago

NPM install always installs the latest version, which in this case is the alpha version. I may merge v3 as is to avoid confusion and continue work on it.

https://medium.com/@mbostock/prereleases-and-npm-e778fc5e2420