{"action":"created","comment":{"url":"https://api.github.com/repos/ianstormtaylor/slate/pulls/comments/208763495","pull_request_review_id":144640474,"id":208763495,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODc2MzQ5NQ==","diff_hunk":"@@ -228,15 +176,51 @@ class Editor extends React.Component {\n    */\n \n   get schema() {\n-    return this.state.schema\n+    const plugins = this.resolvePlugins(this.props.plugins, this.props.schema)\n+    return this.resolveSchema(plugins)\n   }\n \n   get stack() {\n-    return this.state.stack\n+    const plugins = this.resolvePlugins(this.props.plugins, this.props.schema)\n+    return this.resolveStack(plugins)\n   }\n \n   get value() {\n-    return this.state.value\n+    if (this.tmp.value === this.props.value && this.tmp.stack === this.stack) {\n+      const { value } = this.tmp\n+      this.queueChange(value.change())\n+      return value\n+    }\n+\n+    return this.associateStackAndValue(this.props.value, this.stack)\n+  }\n+\n+  /**\n+   * Get value after onChange stack, it is a memoized function and therefore do not need\n+   * to re-evaluate for the same value and stack.\n+   *\n+   * If the value is produced by onChange with the same stack, then will immediately return\n+   * this value.\n+   *\n+   * @param {Value} value\n+   * @param {Stack} stack\n+   * @return {Change}\n+   */\n+\n+  associateStackAndValue = memoizeOne((value, stack) => {\n+    const change = value.change()\n+    stack.run('onChange', change, this)\n+    this.queueChange(change)\n+    return change.value\n+  })\n+\n+  /**\n+   * Queue a change object with value, to save operations of an value\n+   * @param {Change} change\n+   */\n+\n+  queueChange(change) {","path":"packages/slate-react/src/components/editor.js","position":246,"original_position":246,"commit_id":"c8faf84197452b7c0b21afc9604779f611c590a6","original_commit_id":"c8faf84197452b7c0b21afc9604779f611c590a6","user":{"login":"ianstormtaylor","id":311752,"node_id":"MDQ6VXNlcjMxMTc1Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/311752?v=4","gravatar_id":"","url":"https://api.github.com/users/ianstormtaylor","html_url":"https://github.com/ianstormtaylor","followers_url":"https://api.github.com/users/ianstormtaylor/followers","following_url":"https://api.github.com/users/ianstormtaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianstormtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianstormtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianstormtaylor/subscriptions","organizations_url":"https://api.github.com/users/ianstormtaylor/orgs","repos_url":"https://api.github.com/users/ianstormtaylor/repos","events_url":"https://api.github.com/users/ianstormtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianstormtaylor/received_events","type":"User","site_admin":false},"body":"Can you remove this function and inline the logic instead since it's only used in one place now?","created_at":"2018-08-08T23:08:43Z","updated_at":"2018-08-08T23:16:13Z","html_url":"https://github.com/ianstormtaylor/slate/pull/1975#discussion_r208763495","pull_request_url":"https://api.github.com/repos/ianstormtaylor/slate/pulls/1975","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/ianstormtaylor/slate/pulls/comments/208763495"},"html":{"href":"https://github.com/ianstormtaylor/slate/pull/1975#discussion_r208763495"},"pull_request":{"href":"https://api.github.com/repos/ianstormtaylor/slate/pulls/1975"}}},"pull_request":{"url":"https://api.github.com/repos/ianstormtaylor/slate/pulls/1975","id":201812798,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAxODEyNzk4","html_url":"https://github.com/ianstormtaylor/slate/pull/1975","diff_url":"https://github.com/ianstormtaylor/slate/pull/1975.diff","patch_url":"https://github.com/ianstormtaylor/slate/pull/1975.patch","issue_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/1975","number":1975,"state":"open","locked":false,"title":"Upgrade to React v16 lifecycle","user":{"login":"zhujinxuan","id":746159,"node_id":"MDQ6VXNlcjc0NjE1OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/746159?v=4","gravatar_id":"","url":"https://api.github.com/users/zhujinxuan","html_url":"https://github.com/zhujinxuan","followers_url":"https://api.github.com/users/zhujinxuan/followers","following_url":"https://api.github.com/users/zhujinxuan/following{/other_user}","gists_url":"https://api.github.com/users/zhujinxuan/gists{/gist_id}","starred_url":"https://api.github.com/users/zhujinxuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhujinxuan/subscriptions","organizations_url":"https://api.github.com/users/zhujinxuan/orgs","repos_url":"https://api.github.com/users/zhujinxuan/repos","events_url":"https://api.github.com/users/zhujinxuan/events{/privacy}","received_events_url":"https://api.github.com/users/zhujinxuan/received_events","type":"User","site_admin":false},"body":"#### Is this adding or improving a _feature_ or fixing a _bug_?\r\n\r\nfeature\r\n\r\n#### What's the new behavior?\r\n\r\n1. use `memoize-one` instead of state as recommended in reactJS https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html#what-about-memoization\r\n2. value is handled by and only `props.onChange`, then no state.value is provided.\r\n3. Remove flushChange in componentDidUpdate.  After mount, all update will go to onEvent->change->onChange->`props.onChange`\r\n\r\n#### Does this fix any issues or need any specific reviewers?\r\n\r\nFixes: #\r\nReviewers: @\r\n","created_at":"2018-07-17T03:07:50Z","updated_at":"2018-08-08T23:16:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"74d7ae11ffb202be51f2f63d390a588c4303e55b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ianstormtaylor/slate/pulls/1975/commits","review_comments_url":"https://api.github.com/repos/ianstormtaylor/slate/pulls/1975/comments","review_comment_url":"https://api.github.com/repos/ianstormtaylor/slate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/1975/comments","statuses_url":"https://api.github.com/repos/ianstormtaylor/slate/statuses/c8faf84197452b7c0b21afc9604779f611c590a6","head":{"label":"zhujinxuan:slate-react-v16","ref":"slate-react-v16","sha":"c8faf84197452b7c0b21afc9604779f611c590a6","user":{"login":"zhujinxuan","id":746159,"node_id":"MDQ6VXNlcjc0NjE1OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/746159?v=4","gravatar_id":"","url":"https://api.github.com/users/zhujinxuan","html_url":"https://github.com/zhujinxuan","followers_url":"https://api.github.com/users/zhujinxuan/followers","following_url":"https://api.github.com/users/zhujinxuan/following{/other_user}","gists_url":"https://api.github.com/users/zhujinxuan/gists{/gist_id}","starred_url":"https://api.github.com/users/zhujinxuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhujinxuan/subscriptions","organizations_url":"https://api.github.com/users/zhujinxuan/orgs","repos_url":"https://api.github.com/users/zhujinxuan/repos","events_url":"https://api.github.com/users/zhujinxuan/events{/privacy}","received_events_url":"https://api.github.com/users/zhujinxuan/received_events","type":"User","site_admin":false},"repo":{"id":117600430,"node_id":"MDEwOlJlcG9zaXRvcnkxMTc2MDA0MzA=","name":"slate","full_name":"zhujinxuan/slate","owner":{"login":"zhujinxuan","id":746159,"node_id":"MDQ6VXNlcjc0NjE1OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/746159?v=4","gravatar_id":"","url":"https://api.github.com/users/zhujinxuan","html_url":"https://github.com/zhujinxuan","followers_url":"https://api.github.com/users/zhujinxuan/followers","following_url":"https://api.github.com/users/zhujinxuan/following{/other_user}","gists_url":"https://api.github.com/users/zhujinxuan/gists{/gist_id}","starred_url":"https://api.github.com/users/zhujinxuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhujinxuan/subscriptions","organizations_url":"https://api.github.com/users/zhujinxuan/orgs","repos_url":"https://api.github.com/users/zhujinxuan/repos","events_url":"https://api.github.com/users/zhujinxuan/events{/privacy}","received_events_url":"https://api.github.com/users/zhujinxuan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zhujinxuan/slate","description":"A completely customizable framework for building rich text editors.","fork":true,"url":"https://api.github.com/repos/zhujinxuan/slate","forks_url":"https://api.github.com/repos/zhujinxuan/slate/forks","keys_url":"https://api.github.com/repos/zhujinxuan/slate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zhujinxuan/slate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zhujinxuan/slate/teams","hooks_url":"https://api.github.com/repos/zhujinxuan/slate/hooks","issue_events_url":"https://api.github.com/repos/zhujinxuan/slate/issues/events{/number}","events_url":"https://api.github.com/repos/zhujinxuan/slate/events","assignees_url":"https://api.github.com/repos/zhujinxuan/slate/assignees{/user}","branches_url":"https://api.github.com/repos/zhujinxuan/slate/branches{/branch}","tags_url":"https://api.github.com/repos/zhujinxuan/slate/tags","blobs_url":"https://api.github.com/repos/zhujinxuan/slate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zhujinxuan/slate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zhujinxuan/slate/git/refs{/sha}","trees_url":"https://api.github.com/repos/zhujinxuan/slate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zhujinxuan/slate/statuses/{sha}","languages_url":"https://api.github.com/repos/zhujinxuan/slate/languages","stargazers_url":"https://api.github.com/repos/zhujinxuan/slate/stargazers","contributors_url":"https://api.github.com/repos/zhujinxuan/slate/contributors","subscribers_url":"https://api.github.com/repos/zhujinxuan/slate/subscribers","subscription_url":"https://api.github.com/repos/zhujinxuan/slate/subscription","commits_url":"https://api.github.com/repos/zhujinxuan/slate/commits{/sha}","git_commits_url":"https://api.github.com/repos/zhujinxuan/slate/git/commits{/sha}","comments_url":"https://api.github.com/repos/zhujinxuan/slate/comments{/number}","issue_comment_url":"https://api.github.com/repos/zhujinxuan/slate/issues/comments{/number}","contents_url":"https://api.github.com/repos/zhujinxuan/slate/contents/{+path}","compare_url":"https://api.github.com/repos/zhujinxuan/slate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zhujinxuan/slate/merges","archive_url":"https://api.github.com/repos/zhujinxuan/slate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zhujinxuan/slate/downloads","issues_url":"https://api.github.com/repos/zhujinxuan/slate/issues{/number}","pulls_url":"https://api.github.com/repos/zhujinxuan/slate/pulls{/number}","milestones_url":"https://api.github.com/repos/zhujinxuan/slate/milestones{/number}","notifications_url":"https://api.github.com/repos/zhujinxuan/slate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zhujinxuan/slate/labels{/name}","releases_url":"https://api.github.com/repos/zhujinxuan/slate/releases{/id}","deployments_url":"https://api.github.com/repos/zhujinxuan/slate/deployments","created_at":"2018-01-15T22:06:20Z","updated_at":"2018-08-08T14:09:21Z","pushed_at":"2018-08-08T14:09:18Z","git_url":"git://github.com/zhujinxuan/slate.git","ssh_url":"git@github.com:zhujinxuan/slate.git","clone_url":"https://github.com/zhujinxuan/slate.git","svn_url":"https://github.com/zhujinxuan/slate","homepage":"http://slatejs.org","size":183248,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ianstormtaylor:master","ref":"master","sha":"4d974962996935f775dfc0e96794028a46c0e91e","user":{"login":"ianstormtaylor","id":311752,"node_id":"MDQ6VXNlcjMxMTc1Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/311752?v=4","gravatar_id":"","url":"https://api.github.com/users/ianstormtaylor","html_url":"https://github.com/ianstormtaylor","followers_url":"https://api.github.com/users/ianstormtaylor/followers","following_url":"https://api.github.com/users/ianstormtaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianstormtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianstormtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianstormtaylor/subscriptions","organizations_url":"https://api.github.com/users/ianstormtaylor/orgs","repos_url":"https://api.github.com/users/ianstormtaylor/repos","events_url":"https://api.github.com/users/ianstormtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianstormtaylor/received_events","type":"User","site_admin":false},"repo":{"id":61412022,"node_id":"MDEwOlJlcG9zaXRvcnk2MTQxMjAyMg==","name":"slate","full_name":"ianstormtaylor/slate","owner":{"login":"ianstormtaylor","id":311752,"node_id":"MDQ6VXNlcjMxMTc1Mg==","avatar_url":"https://avatars0.githubusercontent.com/u/311752?v=4","gravatar_id":"","url":"https://api.github.com/users/ianstormtaylor","html_url":"https://github.com/ianstormtaylor","followers_url":"https://api.github.com/users/ianstormtaylor/followers","following_url":"https://api.github.com/users/ianstormtaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianstormtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianstormtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianstormtaylor/subscriptions","organizations_url":"https://api.github.com/users/ianstormtaylor/orgs","repos_url":"https://api.github.com/users/ianstormtaylor/repos","events_url":"https://api.github.com/users/ianstormtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianstormtaylor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ianstormtaylor/slate","description":"A completely customizable framework for building rich text editors.","fork":false,"url":"https://api.github.com/repos/ianstormtaylor/slate","forks_url":"https://api.github.com/repos/ianstormtaylor/slate/forks","keys_url":"https://api.github.com/repos/ianstormtaylor/slate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ianstormtaylor/slate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ianstormtaylor/slate/teams","hooks_url":"https://api.github.com/repos/ianstormtaylor/slate/hooks","issue_events_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/events{/number}","events_url":"https://api.github.com/repos/ianstormtaylor/slate/events","assignees_url":"https://api.github.com/repos/ianstormtaylor/slate/assignees{/user}","branches_url":"https://api.github.com/repos/ianstormtaylor/slate/branches{/branch}","tags_url":"https://api.github.com/repos/ianstormtaylor/slate/tags","blobs_url":"https://api.github.com/repos/ianstormtaylor/slate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ianstormtaylor/slate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ianstormtaylor/slate/git/refs{/sha}","trees_url":"https://api.github.com/repos/ianstormtaylor/slate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ianstormtaylor/slate/statuses/{sha}","languages_url":"https://api.github.com/repos/ianstormtaylor/slate/languages","stargazers_url":"https://api.github.com/repos/ianstormtaylor/slate/stargazers","contributors_url":"https://api.github.com/repos/ianstormtaylor/slate/contributors","subscribers_url":"https://api.github.com/repos/ianstormtaylor/slate/subscribers","subscription_url":"https://api.github.com/repos/ianstormtaylor/slate/subscription","commits_url":"https://api.github.com/repos/ianstormtaylor/slate/commits{/sha}","git_commits_url":"https://api.github.com/repos/ianstormtaylor/slate/git/commits{/sha}","comments_url":"https://api.github.com/repos/ianstormtaylor/slate/comments{/number}","issue_comment_url":"https://api.github.com/repos/ianstormtaylor/slate/issues/comments{/number}","contents_url":"https://api.github.com/repos/ianstormtaylor/slate/contents/{+path}","compare_url":"https://api.github.com/repos/ianstormtaylor/slate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ianstormtaylor/slate/merges","archive_url":"https://api.github.com/repos/ianstormtaylor/slate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ianstormtaylor/slate/downloads","issues_url":"https://api.github.com/repos/ianstormtaylor/slate/issues{/number}","pulls_url":"https://api.github.com/repos/ianstormtaylor/slate/pulls{/number}","milestones_url":"https://api.github.com/repos/ianstormtaylor/slate/milestones{/number}","notifications_url":"https://api.github.com/repos/ianstormtaylor/slate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ianstormtaylor/slate/labels{/name}","releases_url":"https://api.github.com/repos/ianstormtaylor/slate/releases{/id}","deployments_url":"https://api.github.com/repos/ianstormtaylor/slate/deployments","created_at":"2016-06-18T01:52:42Z","updated_at":"2018-08-08T22:59:19Z","pushed_at":"2018-08-08T22:59:12Z","git_url":"git://github.com/ianstormtaylor/slate.git","ssh_url":"git@github.com:ianstormtaylor/slate.git","clone_url":"https://github.com/ianstormtaylor/slate.git","svn_url":"https://github.com/ianstormtaylor/slate","homepage":"http://slatejs.org","size":204102,"stargazers_count":8184,"watchers_count":8184,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":667,"mirror_url":null,"archived":false,"open_issues_count":226,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":667,"open_issues":226,"watchers":8184,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ianstormtaylor/slate/pulls/1975"},"html":{"href":"https://github.com/ianstormtaylor/slate/pull/1975"},"issue":{"href":"https://api.github.com/repos/ianstormtaylor/slate/issues/1975"},"comments":{"href":"https://api.github.com/repos/ianstormtaylor/slate/issues/1975/comments"},"review_comments":{"href":"https://api.github.com/repos/ianstormtaylor/slate/pulls/1975/comments"},"review_comment":{"href":"https://api.github.com/repos/ianstormtaylor/slate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ianstormtaylor/slate/pulls/1975/commits"},"statuses":{"href":"https://api.github.com/repos/ianstormtaylor/slate/statuses/c8faf84197452b7c0b21afc9604779f611c590a6"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ianstormtaylor"}}