{"action":"created","comment":{"url":"https://api.github.com/repos/snphq/react-sortable-hoc/pulls/comments/136954581","pull_request_review_id":60556061,"id":136954581,"diff_hunk":"@@ -90,59 +86,69 @@ export default function sortableElement(WrappedComponent, config = {withRef: fal\n     }\n \n     onSelect = (e) => {\n+      const manager = this.context.manager;\n+      const dragLayer = manager.dragLayer;\n+      const selectedItemsOnDragLayer = dragLayer.selectedItems;\n       if (!(e.metaKey || e.ctrlKey)){\n-        unselect.forEach(func=>func());\n-        unselect=[];\n+        dragLayer.unselectAll();\n+        dragLayer.removeAllSelectedFromManagers();\n       }\n-      this.setState({\n-        selected: !this.state.selected,\n-      });\n       if (!this.state.selected){\n-        this.context.manager.selected.push(this.node.sortableInfo.index);\n-        unselect.push(this.unselect);\n+        manager.selected.push(this.node.sortableInfo.index);\n+        selectedItemsOnDragLayer.push(this);\n       }else{\n-        const selected = this.context.manager.selected;\n-        const index = selected.indexOf(this.node.sortableInfo);\n-        selected.splice(index, 1);\n-        unselect.splice(unselect.indexOf(this.unselect),1);\n+        this.removeSelectedFromManager();\n+        this.removeSelectedFromDraglayer();\n       }\n+      this.setState({\n+        selected: !this.state.selected,\n+      });\n     }\n \n-    unselect=()=>{\n+    unselect(){\n       this.setState({\n         selected: false,\n       });\n-      const selected = this.context.manager.selected;\n-      const index = selected.indexOf(this.node.sortableInfo);\n-      selected.splice(index, 1);\n+    }\n+\n+    removeSelectedFromDraglayer(){\n+      removeItem(this.context.manager.dragLayer.selectedItems, this);\n+    }\n+\n+    removeSelectedFromManager(){\n+      removeItem(this.context.manager.selected, this.node.sortableInfo);\n     }\n \n     render() {\n       const ref = config.withRef ? 'wrappedInstance' : null;\n-      const props = {\n-\n-      };\n-      const item = this.props.item;\n-      if (item && item.selectedItems){\n-        const items =  item.selectedItems.map((value, index)=>{\n-          return <WrappedComponent\n-                    key={index}\n-                    item={value}\n-                    className={this.helperClass}\n-                />;\n-        });\n+      const props = {...omit(this.props, 'collection', 'disabled', 'index')};\n+      const {selectedItems} = this.props;\n+      if (selectedItems){\n         return (\n-            <div>{items}</div>\n+          <div>\n+            {selectedItems.map((value, index)=>\n+              <div\n+                key={index}\n+                className={this.helperClass}>\n+                  <WrappedComponent\n+                    key={index}\n+                    {...value}\n+                    {...props}\n+                  />\n+              </div>)}\n+          </div>\n         );\n       }\n       const component = <WrappedComponent\n           ref={ref}\n-          className={this.state.selected ? this.helperClass : ''}\n-          {...omit(this.props, 'collection', 'disabled', 'index')}\n-          onSelect={this.onSelect}\n-          {...props}/>;\n+          {...props}\n+      />;","path":"src/SortableElement/index.js","position":129,"original_position":129,"commit_id":"71a8258071294863fdd21fddb5a036459706b293","original_commit_id":"71a8258071294863fdd21fddb5a036459706b293","user":{"login":"AleksandrLv","id":13856230,"avatar_url":"https://avatars1.githubusercontent.com/u/13856230?v=4","gravatar_id":"","url":"https://api.github.com/users/AleksandrLv","html_url":"https://github.com/AleksandrLv","followers_url":"https://api.github.com/users/AleksandrLv/followers","following_url":"https://api.github.com/users/AleksandrLv/following{/other_user}","gists_url":"https://api.github.com/users/AleksandrLv/gists{/gist_id}","starred_url":"https://api.github.com/users/AleksandrLv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AleksandrLv/subscriptions","organizations_url":"https://api.github.com/users/AleksandrLv/orgs","repos_url":"https://api.github.com/users/AleksandrLv/repos","events_url":"https://api.github.com/users/AleksandrLv/events{/privacy}","received_events_url":"https://api.github.com/users/AleksandrLv/received_events","type":"User","site_admin":false},"body":"Лучше так записать\r\n```\r\nconst component = (\r\n    <WrappedComponent\r\n        ref={ref}\r\n        {...props}\r\n    />\r\n);","created_at":"2017-09-05T10:54:40Z","updated_at":"2017-09-05T11:00:07Z","html_url":"https://github.com/snphq/react-sortable-hoc/pull/2#discussion_r136954581","pull_request_url":"https://api.github.com/repos/snphq/react-sortable-hoc/pulls/2","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/snphq/react-sortable-hoc/pulls/comments/136954581"},"html":{"href":"https://github.com/snphq/react-sortable-hoc/pull/2#discussion_r136954581"},"pull_request":{"href":"https://api.github.com/repos/snphq/react-sortable-hoc/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/snphq/react-sortable-hoc/pulls/2","id":139177628,"html_url":"https://github.com/snphq/react-sortable-hoc/pull/2","diff_url":"https://github.com/snphq/react-sortable-hoc/pull/2.diff","patch_url":"https://github.com/snphq/react-sortable-hoc/pull/2.patch","issue_url":"https://api.github.com/repos/snphq/react-sortable-hoc/issues/2","number":2,"state":"open","locked":false,"title":"fixes","user":{"login":"mixa9269","id":16414787,"avatar_url":"https://avatars0.githubusercontent.com/u/16414787?v=4","gravatar_id":"","url":"https://api.github.com/users/mixa9269","html_url":"https://github.com/mixa9269","followers_url":"https://api.github.com/users/mixa9269/followers","following_url":"https://api.github.com/users/mixa9269/following{/other_user}","gists_url":"https://api.github.com/users/mixa9269/gists{/gist_id}","starred_url":"https://api.github.com/users/mixa9269/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mixa9269/subscriptions","organizations_url":"https://api.github.com/users/mixa9269/orgs","repos_url":"https://api.github.com/users/mixa9269/repos","events_url":"https://api.github.com/users/mixa9269/events{/privacy}","received_events_url":"https://api.github.com/users/mixa9269/received_events","type":"User","site_admin":false},"body":"fix simultaneous drag nested elements;\r\nadd selectedClass;\r\nadd zIndex for helper;\r\nfix GetScrollContainer();\r\nadd prevItem to multipleSortEnd info;\r\nfix multiple drag;\r\n","created_at":"2017-09-04T15:13:12Z","updated_at":"2017-09-05T11:00:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4931515b17c9854bd374da9d0a6482172cf625b8","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/snphq/react-sortable-hoc/pulls/2/commits","review_comments_url":"https://api.github.com/repos/snphq/react-sortable-hoc/pulls/2/comments","review_comment_url":"https://api.github.com/repos/snphq/react-sortable-hoc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/snphq/react-sortable-hoc/issues/2/comments","statuses_url":"https://api.github.com/repos/snphq/react-sortable-hoc/statuses/71a8258071294863fdd21fddb5a036459706b293","head":{"label":"mixa9269:m_feature","ref":"m_feature","sha":"71a8258071294863fdd21fddb5a036459706b293","user":{"login":"mixa9269","id":16414787,"avatar_url":"https://avatars0.githubusercontent.com/u/16414787?v=4","gravatar_id":"","url":"https://api.github.com/users/mixa9269","html_url":"https://github.com/mixa9269","followers_url":"https://api.github.com/users/mixa9269/followers","following_url":"https://api.github.com/users/mixa9269/following{/other_user}","gists_url":"https://api.github.com/users/mixa9269/gists{/gist_id}","starred_url":"https://api.github.com/users/mixa9269/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mixa9269/subscriptions","organizations_url":"https://api.github.com/users/mixa9269/orgs","repos_url":"https://api.github.com/users/mixa9269/repos","events_url":"https://api.github.com/users/mixa9269/events{/privacy}","received_events_url":"https://api.github.com/users/mixa9269/received_events","type":"User","site_admin":false},"repo":{"id":101727429,"name":"react-sortable-hoc","full_name":"mixa9269/react-sortable-hoc","owner":{"login":"mixa9269","id":16414787,"avatar_url":"https://avatars0.githubusercontent.com/u/16414787?v=4","gravatar_id":"","url":"https://api.github.com/users/mixa9269","html_url":"https://github.com/mixa9269","followers_url":"https://api.github.com/users/mixa9269/followers","following_url":"https://api.github.com/users/mixa9269/following{/other_user}","gists_url":"https://api.github.com/users/mixa9269/gists{/gist_id}","starred_url":"https://api.github.com/users/mixa9269/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mixa9269/subscriptions","organizations_url":"https://api.github.com/users/mixa9269/orgs","repos_url":"https://api.github.com/users/mixa9269/repos","events_url":"https://api.github.com/users/mixa9269/events{/privacy}","received_events_url":"https://api.github.com/users/mixa9269/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mixa9269/react-sortable-hoc","description":"A set of higher-order components to turn any list into an animated, touch-friendly, sortable list ✌️","fork":true,"url":"https://api.github.com/repos/mixa9269/react-sortable-hoc","forks_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/forks","keys_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/teams","hooks_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/hooks","issue_events_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/issues/events{/number}","events_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/events","assignees_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/assignees{/user}","branches_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/branches{/branch}","tags_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/tags","blobs_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/git/refs{/sha}","trees_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/statuses/{sha}","languages_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/languages","stargazers_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/stargazers","contributors_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/contributors","subscribers_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/subscribers","subscription_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/subscription","commits_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/commits{/sha}","git_commits_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/git/commits{/sha}","comments_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/comments{/number}","issue_comment_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/issues/comments{/number}","contents_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/contents/{+path}","compare_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/merges","archive_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/downloads","issues_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/issues{/number}","pulls_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/pulls{/number}","milestones_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/milestones{/number}","notifications_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/labels{/name}","releases_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/releases{/id}","deployments_url":"https://api.github.com/repos/mixa9269/react-sortable-hoc/deployments","created_at":"2017-08-29T06:33:05Z","updated_at":"2017-08-29T06:33:07Z","pushed_at":"2017-09-05T10:13:25Z","git_url":"git://github.com/mixa9269/react-sortable-hoc.git","ssh_url":"git@github.com:mixa9269/react-sortable-hoc.git","clone_url":"https://github.com/mixa9269/react-sortable-hoc.git","svn_url":"https://github.com/mixa9269/react-sortable-hoc","homepage":"http://clauderic.github.io/react-sortable-hoc/","size":19975,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"snphq:master","ref":"master","sha":"b5e4636a6bf87e51f44a8a978889139a17f6854d","user":{"login":"snphq","id":9194399,"avatar_url":"https://avatars1.githubusercontent.com/u/9194399?v=4","gravatar_id":"","url":"https://api.github.com/users/snphq","html_url":"https://github.com/snphq","followers_url":"https://api.github.com/users/snphq/followers","following_url":"https://api.github.com/users/snphq/following{/other_user}","gists_url":"https://api.github.com/users/snphq/gists{/gist_id}","starred_url":"https://api.github.com/users/snphq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snphq/subscriptions","organizations_url":"https://api.github.com/users/snphq/orgs","repos_url":"https://api.github.com/users/snphq/repos","events_url":"https://api.github.com/users/snphq/events{/privacy}","received_events_url":"https://api.github.com/users/snphq/received_events","type":"Organization","site_admin":false},"repo":{"id":101642445,"name":"react-sortable-hoc","full_name":"snphq/react-sortable-hoc","owner":{"login":"snphq","id":9194399,"avatar_url":"https://avatars1.githubusercontent.com/u/9194399?v=4","gravatar_id":"","url":"https://api.github.com/users/snphq","html_url":"https://github.com/snphq","followers_url":"https://api.github.com/users/snphq/followers","following_url":"https://api.github.com/users/snphq/following{/other_user}","gists_url":"https://api.github.com/users/snphq/gists{/gist_id}","starred_url":"https://api.github.com/users/snphq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snphq/subscriptions","organizations_url":"https://api.github.com/users/snphq/orgs","repos_url":"https://api.github.com/users/snphq/repos","events_url":"https://api.github.com/users/snphq/events{/privacy}","received_events_url":"https://api.github.com/users/snphq/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/snphq/react-sortable-hoc","description":"A set of higher-order components to turn any list into an animated, touch-friendly, sortable list ✌️","fork":true,"url":"https://api.github.com/repos/snphq/react-sortable-hoc","forks_url":"https://api.github.com/repos/snphq/react-sortable-hoc/forks","keys_url":"https://api.github.com/repos/snphq/react-sortable-hoc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/snphq/react-sortable-hoc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/snphq/react-sortable-hoc/teams","hooks_url":"https://api.github.com/repos/snphq/react-sortable-hoc/hooks","issue_events_url":"https://api.github.com/repos/snphq/react-sortable-hoc/issues/events{/number}","events_url":"https://api.github.com/repos/snphq/react-sortable-hoc/events","assignees_url":"https://api.github.com/repos/snphq/react-sortable-hoc/assignees{/user}","branches_url":"https://api.github.com/repos/snphq/react-sortable-hoc/branches{/branch}","tags_url":"https://api.github.com/repos/snphq/react-sortable-hoc/tags","blobs_url":"https://api.github.com/repos/snphq/react-sortable-hoc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/snphq/react-sortable-hoc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/snphq/react-sortable-hoc/git/refs{/sha}","trees_url":"https://api.github.com/repos/snphq/react-sortable-hoc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/snphq/react-sortable-hoc/statuses/{sha}","languages_url":"https://api.github.com/repos/snphq/react-sortable-hoc/languages","stargazers_url":"https://api.github.com/repos/snphq/react-sortable-hoc/stargazers","contributors_url":"https://api.github.com/repos/snphq/react-sortable-hoc/contributors","subscribers_url":"https://api.github.com/repos/snphq/react-sortable-hoc/subscribers","subscription_url":"https://api.github.com/repos/snphq/react-sortable-hoc/subscription","commits_url":"https://api.github.com/repos/snphq/react-sortable-hoc/commits{/sha}","git_commits_url":"https://api.github.com/repos/snphq/react-sortable-hoc/git/commits{/sha}","comments_url":"https://api.github.com/repos/snphq/react-sortable-hoc/comments{/number}","issue_comment_url":"https://api.github.com/repos/snphq/react-sortable-hoc/issues/comments{/number}","contents_url":"https://api.github.com/repos/snphq/react-sortable-hoc/contents/{+path}","compare_url":"https://api.github.com/repos/snphq/react-sortable-hoc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/snphq/react-sortable-hoc/merges","archive_url":"https://api.github.com/repos/snphq/react-sortable-hoc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/snphq/react-sortable-hoc/downloads","issues_url":"https://api.github.com/repos/snphq/react-sortable-hoc/issues{/number}","pulls_url":"https://api.github.com/repos/snphq/react-sortable-hoc/pulls{/number}","milestones_url":"https://api.github.com/repos/snphq/react-sortable-hoc/milestones{/number}","notifications_url":"https://api.github.com/repos/snphq/react-sortable-hoc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/snphq/react-sortable-hoc/labels{/name}","releases_url":"https://api.github.com/repos/snphq/react-sortable-hoc/releases{/id}","deployments_url":"https://api.github.com/repos/snphq/react-sortable-hoc/deployments","created_at":"2017-08-28T12:48:01Z","updated_at":"2017-08-28T12:48:03Z","pushed_at":"2017-09-05T10:13:27Z","git_url":"git://github.com/snphq/react-sortable-hoc.git","ssh_url":"git@github.com:snphq/react-sortable-hoc.git","clone_url":"https://github.com/snphq/react-sortable-hoc.git","svn_url":"https://github.com/snphq/react-sortable-hoc","homepage":"http://clauderic.github.io/react-sortable-hoc/","size":19972,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/snphq/react-sortable-hoc/pulls/2"},"html":{"href":"https://github.com/snphq/react-sortable-hoc/pull/2"},"issue":{"href":"https://api.github.com/repos/snphq/react-sortable-hoc/issues/2"},"comments":{"href":"https://api.github.com/repos/snphq/react-sortable-hoc/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/snphq/react-sortable-hoc/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/snphq/react-sortable-hoc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/snphq/react-sortable-hoc/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/snphq/react-sortable-hoc/statuses/71a8258071294863fdd21fddb5a036459706b293"}},"author_association":"NONE"}}
{"actor":{"display_login":"AleksandrLv"}}