-
Notifications
You must be signed in to change notification settings - Fork 84
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
Doesn't work with mapped SortableItems #26
Comments
I've tweaked the demo to return mapped items and it just works, please check it out. react-anything-sortable/demo/index.js Line 92 in 0867f14
|
Okay the issue lies within using redux. Still a mystery. But I made a project which shows the issue. Install and run with:
Just try clicking the "+1" button a few times which calls a redux action which increments the counter. The counter is obviously working, but for some reason, Sortable is not rendering the components. Thanks |
If you're adding or removing children of Check the notice section of docs for more information. https://github.com/jasonslyvia/react-anything-sortable#notice |
Also you can refer to this demo for handling dynamic children modification. |
@jasonslyvia There is a bug on an edge case (tried with your updated demo also): Mapped items + fixed items breaks the dragging capabilities. I'm not sure why, currently investigating, but could use your help on this one! Just try to add a fixed item in your demo, and you will see what's happening :) Cheers |
Sure, I'll look into it. |
Thanks! In the render function, you can try this: <div className="dynamic-demo">
<button onClick={::this.handleAddElement}>Add 1 element</button>
<Sortable key={this._sortableKey} onSort={::this.handleSort}>
{this.state.arr.map(renderItem, this)}
<span>Hello</span>
</Sortable>
</div> Let me know what you think |
Have you tried add |
@jasonslyvia Yes, no luck either |
Also removing |
@jasonslyvia Same thing :) |
Alright then, I will test it myself. |
@jasonslyvia Any news on this? Thanks! |
@JonathanWi Sorry been busy these days, this behaviour is confirmed not working as expected, gonna need more time digging why. |
Btw, I think it's a totally different issue from the original one, do you care posting a new issue so we can move discussion there? |
This works:
This doesnt:
And by doesn't work, I mean nothing is rendered within sortable.
If I render the
{items.map(renderItem)}
outside of<Sortable>
, it works...Very odd.
The text was updated successfully, but these errors were encountered: