{"action":"created","comment":{"url":"https://api.github.com/repos/plotly/plotly.js/pulls/comments/166668780","pull_request_review_id":94769164,"id":166668780,"diff_hunk":"@@ -2171,6 +2171,239 @@ describe('Test plot api', function() {\n             });\n         });\n     });\n+\n+    describe('Plotly.react', function() {\n+        var mockedMethods = [\n+            'doTraceStyle',\n+            'doColorBars',\n+            'doLegend',\n+            'layoutStyles',\n+            'doTicksRelayout',\n+            'doModeBar',\n+            'doCamera'\n+        ];\n+\n+        var gd;\n+        var plotCalls;\n+\n+        beforeEach(function() {\n+            gd = createGraphDiv();\n+\n+            mockedMethods.forEach(function(m) {\n+                spyOn(subroutines, m).and.callThrough();\n+                subroutines[m].calls.reset();\n+            });\n+        });\n+\n+        afterEach(destroyGraphDiv);\n+\n+        function countPlots() {\n+            plotCalls = 0;\n+\n+            gd.on('plotly_afterplot', function() { plotCalls++; });\n+            subroutines.layoutStyles.calls.reset();\n+        }\n+\n+        function countCalls(counts) {\n+            var callsFinal = Lib.extendFlat({}, counts);\n+            // TODO: do we really need to do layoutStyles twice in Plotly.plot?","path":"test/jasmine/tests/plot_api_test.js","position":55,"original_position":39,"commit_id":"e58b74d185a0cc00353ba80e60489a449b77145d","original_commit_id":"54b69696868cb04d65ae636d6e0b5475299c602a","user":{"login":"alexcjohnson","id":2678795,"avatar_url":"https://avatars3.githubusercontent.com/u/2678795?v=4","gravatar_id":"","url":"https://api.github.com/users/alexcjohnson","html_url":"https://github.com/alexcjohnson","followers_url":"https://api.github.com/users/alexcjohnson/followers","following_url":"https://api.github.com/users/alexcjohnson/following{/other_user}","gists_url":"https://api.github.com/users/alexcjohnson/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcjohnson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcjohnson/subscriptions","organizations_url":"https://api.github.com/users/alexcjohnson/orgs","repos_url":"https://api.github.com/users/alexcjohnson/repos","events_url":"https://api.github.com/users/alexcjohnson/events{/privacy}","received_events_url":"https://api.github.com/users/alexcjohnson/received_events","type":"User","site_admin":false},"body":"I suspect this is about automargins - right now the drawing pipeline is like:\r\n- draw everything that can alter margins\r\n- check if anything is too big and needs to change margins\r\n- draw that stuff again if the margins changed\r\n- then draw all the stuff that can't change the margins\r\n\r\nwe really should refactor it to something like:\r\n- *calculate* the sizes of everything that can alter margins, without actually drawing it\r\n- calculate all the automargins (which determines the positions of everything)\r\n- draw everything\r\n\r\nor perhaps:\r\n- draw everything that can alter margins, but don't position it\r\n- calculate all the automargins\r\n- position the predrawn items\r\n- draw everything else","created_at":"2018-02-07T16:14:55Z","updated_at":"2018-02-07T16:14:56Z","html_url":"https://github.com/plotly/plotly.js/pull/2341#discussion_r166668780","pull_request_url":"https://api.github.com/repos/plotly/plotly.js/pulls/2341","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/comments/166668780"},"html":{"href":"https://github.com/plotly/plotly.js/pull/2341#discussion_r166668780"},"pull_request":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/2341"}},"in_reply_to_id":166513363},"pull_request":{"url":"https://api.github.com/repos/plotly/plotly.js/pulls/2341","id":167553235,"html_url":"https://github.com/plotly/plotly.js/pull/2341","diff_url":"https://github.com/plotly/plotly.js/pull/2341.diff","patch_url":"https://github.com/plotly/plotly.js/pull/2341.patch","issue_url":"https://api.github.com/repos/plotly/plotly.js/issues/2341","number":2341,"state":"open","locked":false,"title":"Plotly.react","user":{"login":"alexcjohnson","id":2678795,"avatar_url":"https://avatars3.githubusercontent.com/u/2678795?v=4","gravatar_id":"","url":"https://api.github.com/users/alexcjohnson","html_url":"https://github.com/alexcjohnson","followers_url":"https://api.github.com/users/alexcjohnson/followers","following_url":"https://api.github.com/users/alexcjohnson/following{/other_user}","gists_url":"https://api.github.com/users/alexcjohnson/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcjohnson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcjohnson/subscriptions","organizations_url":"https://api.github.com/users/alexcjohnson/orgs","repos_url":"https://api.github.com/users/alexcjohnson/repos","events_url":"https://api.github.com/users/alexcjohnson/events{/privacy}","received_events_url":"https://api.github.com/users/alexcjohnson/received_events","type":"User","site_admin":false},"body":"Introduces `Plotly.react` - an idempotent, full-state, self-diffing update method with a signature matching `Plotly.newPlot` but using the faster update pathways of `Plotly.restyle/relayout/update`.\r\n\r\nDiffing is done on `fullData` and `fullLayout`, not on `data` and `layout`, for a few reasons:\r\n- We don't copy `data` and `layout`, so there's nothing to diff there if the user modifies them in place. But `_full*` get regenerated as new objects with every `supplyDefaults` call (which must happen on every update regardless).\r\n- No need to worry about the data types we're diffing, as `supplyDefaults` cleans that up. Also we won't diff user attributes that don't go into the plot, or irrelevant leftovers of old plot types.\r\n\r\nWe do NOT dive into data arrays (`valType: 'data_array'` or `arrayOk: true`) in the diffing algorithm. There are two ways to tell `Plotly.react` that the data have changed:\r\n- `layout.datarevision`: can take any value - string, number, whatever - and if it is not `===` its previous value, we treat the data as changed. Data arrays themselves are ignored during diffing. Note that right now there's no difference in the pathway we'd take for one vs all data arrays changing, but in the future if we implement partial recalc we can make a similar flag for each array, or perhaps each trace.\r\n- If you omit `datarevision`, we assume data arrays are being used as immutable and compare them with `===` to determine if anything changed. This has some known issues (resulting in slow recalc when it wouldn't be needed) that we should fix:\r\n  - At least one trace type (surface) fills in index arrays for missing dimensions. These are never `===` each other. We should provide these later in the pipeline, not attached to `_fullData`, or fill them in as `_private` attributes which do not get diffed.\r\n  - At least one trace type (scatter) will slice uneven arrays to the same length, which will also make them compare unequal. We should just record a private `_length` or something instead.\r\n\r\nsee #1850 \r\ncc @etpinard @chriddyp @nicolaskruchten @VeraZab @jackparmer ","created_at":"2018-02-06T22:57:43Z","updated_at":"2018-02-07T16:14:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0667798c00f65760dd06201f0fc9dad2def8ef7e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":{"url":"https://api.github.com/repos/plotly/plotly.js/milestones/30","html_url":"https://github.com/plotly/plotly.js/milestone/30","labels_url":"https://api.github.com/repos/plotly/plotly.js/milestones/30/labels","id":3053853,"number":30,"title":"v1.34.0","description":null,"creator":{"login":"alexcjohnson","id":2678795,"avatar_url":"https://avatars3.githubusercontent.com/u/2678795?v=4","gravatar_id":"","url":"https://api.github.com/users/alexcjohnson","html_url":"https://github.com/alexcjohnson","followers_url":"https://api.github.com/users/alexcjohnson/followers","following_url":"https://api.github.com/users/alexcjohnson/following{/other_user}","gists_url":"https://api.github.com/users/alexcjohnson/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcjohnson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcjohnson/subscriptions","organizations_url":"https://api.github.com/users/alexcjohnson/orgs","repos_url":"https://api.github.com/users/alexcjohnson/repos","events_url":"https://api.github.com/users/alexcjohnson/events{/privacy}","received_events_url":"https://api.github.com/users/alexcjohnson/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":5,"state":"open","created_at":"2018-01-22T13:49:27Z","updated_at":"2018-02-07T15:50:31Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/plotly/plotly.js/pulls/2341/commits","review_comments_url":"https://api.github.com/repos/plotly/plotly.js/pulls/2341/comments","review_comment_url":"https://api.github.com/repos/plotly/plotly.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/plotly/plotly.js/issues/2341/comments","statuses_url":"https://api.github.com/repos/plotly/plotly.js/statuses/e58b74d185a0cc00353ba80e60489a449b77145d","head":{"label":"plotly:react","ref":"react","sha":"e58b74d185a0cc00353ba80e60489a449b77145d","user":{"login":"plotly","id":5997976,"avatar_url":"https://avatars2.githubusercontent.com/u/5997976?v=4","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"repo":{"id":45646037,"name":"plotly.js","full_name":"plotly/plotly.js","owner":{"login":"plotly","id":5997976,"avatar_url":"https://avatars2.githubusercontent.com/u/5997976?v=4","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/plotly/plotly.js","description":"The open source JavaScript graphing library that powers plotly","fork":false,"url":"https://api.github.com/repos/plotly/plotly.js","forks_url":"https://api.github.com/repos/plotly/plotly.js/forks","keys_url":"https://api.github.com/repos/plotly/plotly.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plotly/plotly.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plotly/plotly.js/teams","hooks_url":"https://api.github.com/repos/plotly/plotly.js/hooks","issue_events_url":"https://api.github.com/repos/plotly/plotly.js/issues/events{/number}","events_url":"https://api.github.com/repos/plotly/plotly.js/events","assignees_url":"https://api.github.com/repos/plotly/plotly.js/assignees{/user}","branches_url":"https://api.github.com/repos/plotly/plotly.js/branches{/branch}","tags_url":"https://api.github.com/repos/plotly/plotly.js/tags","blobs_url":"https://api.github.com/repos/plotly/plotly.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plotly/plotly.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plotly/plotly.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/plotly/plotly.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plotly/plotly.js/statuses/{sha}","languages_url":"https://api.github.com/repos/plotly/plotly.js/languages","stargazers_url":"https://api.github.com/repos/plotly/plotly.js/stargazers","contributors_url":"https://api.github.com/repos/plotly/plotly.js/contributors","subscribers_url":"https://api.github.com/repos/plotly/plotly.js/subscribers","subscription_url":"https://api.github.com/repos/plotly/plotly.js/subscription","commits_url":"https://api.github.com/repos/plotly/plotly.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/plotly/plotly.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/plotly/plotly.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/plotly/plotly.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/plotly/plotly.js/contents/{+path}","compare_url":"https://api.github.com/repos/plotly/plotly.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plotly/plotly.js/merges","archive_url":"https://api.github.com/repos/plotly/plotly.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plotly/plotly.js/downloads","issues_url":"https://api.github.com/repos/plotly/plotly.js/issues{/number}","pulls_url":"https://api.github.com/repos/plotly/plotly.js/pulls{/number}","milestones_url":"https://api.github.com/repos/plotly/plotly.js/milestones{/number}","notifications_url":"https://api.github.com/repos/plotly/plotly.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plotly/plotly.js/labels{/name}","releases_url":"https://api.github.com/repos/plotly/plotly.js/releases{/id}","deployments_url":"https://api.github.com/repos/plotly/plotly.js/deployments","created_at":"2015-11-05T23:27:17Z","updated_at":"2018-02-07T10:11:33Z","pushed_at":"2018-02-07T03:43:52Z","git_url":"git://github.com/plotly/plotly.js.git","ssh_url":"git@github.com:plotly/plotly.js.git","clone_url":"https://github.com/plotly/plotly.js.git","svn_url":"https://github.com/plotly/plotly.js","homepage":"https://plot.ly/javascript/","size":359884,"stargazers_count":7629,"watchers_count":7629,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":856,"mirror_url":null,"archived":false,"open_issues_count":425,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":856,"open_issues":425,"watchers":7629,"default_branch":"master"}},"base":{"label":"plotly:master","ref":"master","sha":"ef2bff1904b50fa6fd01655ac37a588866a0e330","user":{"login":"plotly","id":5997976,"avatar_url":"https://avatars2.githubusercontent.com/u/5997976?v=4","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"repo":{"id":45646037,"name":"plotly.js","full_name":"plotly/plotly.js","owner":{"login":"plotly","id":5997976,"avatar_url":"https://avatars2.githubusercontent.com/u/5997976?v=4","gravatar_id":"","url":"https://api.github.com/users/plotly","html_url":"https://github.com/plotly","followers_url":"https://api.github.com/users/plotly/followers","following_url":"https://api.github.com/users/plotly/following{/other_user}","gists_url":"https://api.github.com/users/plotly/gists{/gist_id}","starred_url":"https://api.github.com/users/plotly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plotly/subscriptions","organizations_url":"https://api.github.com/users/plotly/orgs","repos_url":"https://api.github.com/users/plotly/repos","events_url":"https://api.github.com/users/plotly/events{/privacy}","received_events_url":"https://api.github.com/users/plotly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/plotly/plotly.js","description":"The open source JavaScript graphing library that powers plotly","fork":false,"url":"https://api.github.com/repos/plotly/plotly.js","forks_url":"https://api.github.com/repos/plotly/plotly.js/forks","keys_url":"https://api.github.com/repos/plotly/plotly.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/plotly/plotly.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/plotly/plotly.js/teams","hooks_url":"https://api.github.com/repos/plotly/plotly.js/hooks","issue_events_url":"https://api.github.com/repos/plotly/plotly.js/issues/events{/number}","events_url":"https://api.github.com/repos/plotly/plotly.js/events","assignees_url":"https://api.github.com/repos/plotly/plotly.js/assignees{/user}","branches_url":"https://api.github.com/repos/plotly/plotly.js/branches{/branch}","tags_url":"https://api.github.com/repos/plotly/plotly.js/tags","blobs_url":"https://api.github.com/repos/plotly/plotly.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/plotly/plotly.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/plotly/plotly.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/plotly/plotly.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/plotly/plotly.js/statuses/{sha}","languages_url":"https://api.github.com/repos/plotly/plotly.js/languages","stargazers_url":"https://api.github.com/repos/plotly/plotly.js/stargazers","contributors_url":"https://api.github.com/repos/plotly/plotly.js/contributors","subscribers_url":"https://api.github.com/repos/plotly/plotly.js/subscribers","subscription_url":"https://api.github.com/repos/plotly/plotly.js/subscription","commits_url":"https://api.github.com/repos/plotly/plotly.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/plotly/plotly.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/plotly/plotly.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/plotly/plotly.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/plotly/plotly.js/contents/{+path}","compare_url":"https://api.github.com/repos/plotly/plotly.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/plotly/plotly.js/merges","archive_url":"https://api.github.com/repos/plotly/plotly.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/plotly/plotly.js/downloads","issues_url":"https://api.github.com/repos/plotly/plotly.js/issues{/number}","pulls_url":"https://api.github.com/repos/plotly/plotly.js/pulls{/number}","milestones_url":"https://api.github.com/repos/plotly/plotly.js/milestones{/number}","notifications_url":"https://api.github.com/repos/plotly/plotly.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/plotly/plotly.js/labels{/name}","releases_url":"https://api.github.com/repos/plotly/plotly.js/releases{/id}","deployments_url":"https://api.github.com/repos/plotly/plotly.js/deployments","created_at":"2015-11-05T23:27:17Z","updated_at":"2018-02-07T10:11:33Z","pushed_at":"2018-02-07T03:43:52Z","git_url":"git://github.com/plotly/plotly.js.git","ssh_url":"git@github.com:plotly/plotly.js.git","clone_url":"https://github.com/plotly/plotly.js.git","svn_url":"https://github.com/plotly/plotly.js","homepage":"https://plot.ly/javascript/","size":359884,"stargazers_count":7629,"watchers_count":7629,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":856,"mirror_url":null,"archived":false,"open_issues_count":425,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":856,"open_issues":425,"watchers":7629,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/2341"},"html":{"href":"https://github.com/plotly/plotly.js/pull/2341"},"issue":{"href":"https://api.github.com/repos/plotly/plotly.js/issues/2341"},"comments":{"href":"https://api.github.com/repos/plotly/plotly.js/issues/2341/comments"},"review_comments":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/2341/comments"},"review_comment":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/plotly/plotly.js/pulls/2341/commits"},"statuses":{"href":"https://api.github.com/repos/plotly/plotly.js/statuses/e58b74d185a0cc00353ba80e60489a449b77145d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"alexcjohnson"}}