{"action":"created","comment":{"url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments/43011863","id":43011863,"diff_hunk":"@@ -358,10 +358,36 @@ define(function (require, exports, module) {\n                 }\n             }\n \n-            // swatch\n-            swatchClassSet = classnames(swatchClassProps);\n+            return {\n+                value: value,\n+                label: label,\n+                color: color,\n+                colorTiny: colorTiny\n+            };\n+        },\n+\n+        render: function () {\n+            var colorInfo = this._extractColorInfo(),\n+                value = colorInfo.value,\n+                label = colorInfo.label,\n+                color = colorInfo.color,\n+                colorTiny = colorInfo.colorTiny;\n+\n+            var swatchClassProps = {\n+                    \"color-input\": true\n+                };\n+\n+            // setup text and swatch based on the mixed-ness of the inputs\n+            if (value) {\n+                if (typeof value === \"string\") {\n+                    swatchClassProps[\"color-input__invalid-color\"] = true;","path":"src/js/jsx/shared/ColorInput.jsx","position":76,"original_position":76,"commit_id":"81520b749623955e59eca0551574d4b207bdd7fb","original_commit_id":"81520b749623955e59eca0551574d4b207bdd7fb","user":{"login":"mcilroyc","id":1168110,"avatar_url":"https://avatars.githubusercontent.com/u/1168110?v=3","gravatar_id":"","url":"https://api.github.com/users/mcilroyc","html_url":"https://github.com/mcilroyc","followers_url":"https://api.github.com/users/mcilroyc/followers","following_url":"https://api.github.com/users/mcilroyc/following{/other_user}","gists_url":"https://api.github.com/users/mcilroyc/gists{/gist_id}","starred_url":"https://api.github.com/users/mcilroyc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcilroyc/subscriptions","organizations_url":"https://api.github.com/users/mcilroyc/orgs","repos_url":"https://api.github.com/users/mcilroyc/repos","events_url":"https://api.github.com/users/mcilroyc/events{/privacy}","received_events_url":"https://api.github.com/users/mcilroyc/received_events","type":"User","site_admin":false},"body":"This is just a nit, but it seems like it would be even cleaner to just derive these two booleans (invalid, mixed) in `_extractColorInfo` since it is already doing similar logic, and then assign them to a single clean `swatchClassProps` here.","created_at":"2015-10-26T15:56:03Z","updated_at":"2015-10-26T15:56:03Z","html_url":"https://github.com/adobe-photoshop/spaces-design/pull/3119#discussion_r43011863","pull_request_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/3119","_links":{"self":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments/43011863"},"html":{"href":"https://github.com/adobe-photoshop/spaces-design/pull/3119#discussion_r43011863"},"pull_request":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/3119"}}},"pull_request":{"url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/3119","id":48681868,"html_url":"https://github.com/adobe-photoshop/spaces-design/pull/3119","diff_url":"https://github.com/adobe-photoshop/spaces-design/pull/3119.diff","patch_url":"https://github.com/adobe-photoshop/spaces-design/pull/3119.patch","issue_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/3119","number":3119,"state":"open","locked":false,"title":"Reset color picker sliders on undo/redo","user":{"login":"iwehrman","id":1075154,"avatar_url":"https://avatars.githubusercontent.com/u/1075154?v=3","gravatar_id":"","url":"https://api.github.com/users/iwehrman","html_url":"https://github.com/iwehrman","followers_url":"https://api.github.com/users/iwehrman/followers","following_url":"https://api.github.com/users/iwehrman/following{/other_user}","gists_url":"https://api.github.com/users/iwehrman/gists{/gist_id}","starred_url":"https://api.github.com/users/iwehrman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwehrman/subscriptions","organizations_url":"https://api.github.com/users/iwehrman/orgs","repos_url":"https://api.github.com/users/iwehrman/repos","events_url":"https://api.github.com/users/iwehrman/events{/privacy}","received_events_url":"https://api.github.com/users/iwehrman/received_events","type":"User","site_admin":false},"body":"This fixes two distinct problems with the color picker and undo/redo:\r\n\r\n1. The `ColorInput` listens for `timetravel` events and uses them to forcefully reset the positions of the sliders to an up-to-date value. But, currently, it is simply resetting the sliders to their current position, which achieves nothing. This fixes that by using a value derived by instead re-parsing the input props to determine the correct color to which the sliders should be reset. This involves factoring out the parsing logic currently in the `render` method (which is totally gross) into a separate method which can be called by `render` and by this `timetravel` handler. Mostly this is just a cut-and-paste refactoring, though I did have to make some minor changes to account for `swatchClassProps` and friends.\r\n2. The history store currently emits the `timetravel` event when \"adjusting\" the history state, but in this case it also seems to need to call `updateDocument` in order to update the document model. But this means that the `timetravel` event currently happens well before the document model has been updated, which means even with fix 1) above, the `ColorInput` re-parses its input props before they've been correctly updated. My proposed workaround (which is not intended to be the last word, but instead to just be a minimal fix) involves an additional history event `FINISH_ADJUSTING_HISTORY_STATE`, which is emitted after the history-related `updateDocument` call is complete, and to have the history store emit its `timetravel` event when handling this, instead of earlier in the `ADJUST_HISTORY_STATE` event.\r\n\r\nAddresses #3117. \r\n\r\n@mcilroyc is probably the best person to review this, but I welcome analysis and testing from anyone else!","created_at":"2015-10-25T16:33:16Z","updated_at":"2015-10-26T15:56:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8f6e6c98140c64b730788ef206a9e078e7628fe6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/3119/commits","review_comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/3119/comments","review_comment_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments{/number}","comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/3119/comments","statuses_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/81520b749623955e59eca0551574d4b207bdd7fb","head":{"label":"adobe-photoshop:iwehrman/issue-3117","ref":"iwehrman/issue-3117","sha":"81520b749623955e59eca0551574d4b207bdd7fb","user":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"repo":{"id":37291353,"name":"spaces-design","full_name":"adobe-photoshop/spaces-design","owner":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/adobe-photoshop/spaces-design","description":"Adobe Photoshop Design Space","fork":false,"url":"https://api.github.com/repos/adobe-photoshop/spaces-design","forks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/forks","keys_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/teams","hooks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/hooks","issue_events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/events{/number}","events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/events","assignees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/assignees{/user}","branches_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/branches{/branch}","tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/tags","blobs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/refs{/sha}","trees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/{sha}","languages_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/languages","stargazers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/stargazers","contributors_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contributors","subscribers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscribers","subscription_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscription","commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/commits{/sha}","git_commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/commits{/sha}","comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/comments{/number}","issue_comment_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/comments{/number}","contents_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contents/{+path}","compare_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/merges","archive_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/downloads","issues_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues{/number}","pulls_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls{/number}","milestones_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/milestones{/number}","notifications_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/labels{/name}","releases_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/releases{/id}","created_at":"2015-06-11T23:23:47Z","updated_at":"2015-10-26T15:47:35Z","pushed_at":"2015-10-26T00:05:07Z","git_url":"git://github.com/adobe-photoshop/spaces-design.git","ssh_url":"git@github.com:adobe-photoshop/spaces-design.git","clone_url":"https://github.com/adobe-photoshop/spaces-design.git","svn_url":"https://github.com/adobe-photoshop/spaces-design","homepage":"http://adobe-photoshop.github.io/","size":32566,"stargazers_count":631,"watchers_count":631,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"open_issues_count":190,"forks":41,"open_issues":190,"watchers":631,"default_branch":"master"}},"base":{"label":"adobe-photoshop:master","ref":"master","sha":"170b49ece54798941a823ca0f2b07dd23bb5afef","user":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"repo":{"id":37291353,"name":"spaces-design","full_name":"adobe-photoshop/spaces-design","owner":{"login":"adobe-photoshop","id":4542585,"avatar_url":"https://avatars.githubusercontent.com/u/4542585?v=3","gravatar_id":"","url":"https://api.github.com/users/adobe-photoshop","html_url":"https://github.com/adobe-photoshop","followers_url":"https://api.github.com/users/adobe-photoshop/followers","following_url":"https://api.github.com/users/adobe-photoshop/following{/other_user}","gists_url":"https://api.github.com/users/adobe-photoshop/gists{/gist_id}","starred_url":"https://api.github.com/users/adobe-photoshop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adobe-photoshop/subscriptions","organizations_url":"https://api.github.com/users/adobe-photoshop/orgs","repos_url":"https://api.github.com/users/adobe-photoshop/repos","events_url":"https://api.github.com/users/adobe-photoshop/events{/privacy}","received_events_url":"https://api.github.com/users/adobe-photoshop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/adobe-photoshop/spaces-design","description":"Adobe Photoshop Design Space","fork":false,"url":"https://api.github.com/repos/adobe-photoshop/spaces-design","forks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/forks","keys_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/teams","hooks_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/hooks","issue_events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/events{/number}","events_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/events","assignees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/assignees{/user}","branches_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/branches{/branch}","tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/tags","blobs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/refs{/sha}","trees_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/{sha}","languages_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/languages","stargazers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/stargazers","contributors_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contributors","subscribers_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscribers","subscription_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/subscription","commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/commits{/sha}","git_commits_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/git/commits{/sha}","comments_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/comments{/number}","issue_comment_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/comments{/number}","contents_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/contents/{+path}","compare_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/merges","archive_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/downloads","issues_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues{/number}","pulls_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls{/number}","milestones_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/milestones{/number}","notifications_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/labels{/name}","releases_url":"https://api.github.com/repos/adobe-photoshop/spaces-design/releases{/id}","created_at":"2015-06-11T23:23:47Z","updated_at":"2015-10-26T15:47:35Z","pushed_at":"2015-10-26T00:05:07Z","git_url":"git://github.com/adobe-photoshop/spaces-design.git","ssh_url":"git@github.com:adobe-photoshop/spaces-design.git","clone_url":"https://github.com/adobe-photoshop/spaces-design.git","svn_url":"https://github.com/adobe-photoshop/spaces-design","homepage":"http://adobe-photoshop.github.io/","size":32566,"stargazers_count":631,"watchers_count":631,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"open_issues_count":190,"forks":41,"open_issues":190,"watchers":631,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/3119"},"html":{"href":"https://github.com/adobe-photoshop/spaces-design/pull/3119"},"issue":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/3119"},"comments":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/issues/3119/comments"},"review_comments":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/3119/comments"},"review_comment":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/pulls/3119/commits"},"statuses":{"href":"https://api.github.com/repos/adobe-photoshop/spaces-design/statuses/81520b749623955e59eca0551574d4b207bdd7fb"}}}}