Skip to content
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

Clone option throws error with React v0.14.7 #2

Closed
jakedowns opened this issue Mar 10, 2016 · 3 comments
Closed

Clone option throws error with React v0.14.7 #2

jakedowns opened this issue Mar 10, 2016 · 3 comments

Comments

@jakedowns
Copy link

When I setup two sortable lists, and group them,
with one being set to pull: 'clone'

As soon as I drag the element and drop it on the list with put: true,
The receiving list updates with the new, cloned element as expected,
but the source list gets a duplicate copy of the dropped element, and then react throws the following error: Uncaught Invariant Violation: ReactMount: Two valid but unequal nodes with the same 'data-reactid': .0.0.$5

This might be related to the unmerged fix here: SortableJS/Sortable#612

Just wondering if you're able to reproduce this, or if it's something with my setup.

Let me know if you need a jsfiddle

@cheton
Copy link
Collaborator

cheton commented Mar 11, 2016

I can reproduce the error as you mentioned. I think it might be caused by Sortable.js. I will try to figure out if it is possible to clone new nodes without copying the original data-reactid attribute that was added by React itself.

@cheton
Copy link
Collaborator

cheton commented Apr 10, 2016

I fixed this issue in the dev branch by checking if the group options of a remote Sortable component is set to pull: 'clone'.

if (remote !== this) {
    if (typeof remote.props.group === 'object' && remote.props.group.pull === 'clone') {
        // Remove the node with the same data-reactid
        evt.item.parentNode.removeChild(evt.item);
    }
       :   :   :
}

@cheton
Copy link
Collaborator

cheton commented Apr 11, 2016

Fixed in v1.0.0

Demo: http://cheton.github.io/react-sortable/

@cheton cheton closed this as completed Apr 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants