{"action":"created","comment":{"url":"https://api.github.com/repos/attic-labs/noms/pulls/comments/88703254","pull_request_review_id":9269682,"id":88703254,"diff_hunk":"@@ -43,53 +50,96 @@ export default class PhotoGridItem extends React.Component<void, Props, State> {\n   constructor(props: Props) {\n     super(props);\n     this.state = {\n-      size: props.gridSize,\n-      sizeIsBest: false,\n-      url: props.url,\n+      blob: this.getBlob(props),\n+      tx: false,\n     };\n     this._parentTop = 0;\n     this._parentLeft = 0;\n-    this._shouldTransition = true;\n+    this.load(this.state.blob);\n   }\n \n-  componentWillUpdate() {\n+  componentWillReceiveProps(nextProps) {\n+    const nextBlob = this.getBlob(nextProps);\n+    if (nextBlob == this.state.blob) { \n+      return;\n+    }\n+    this.setState({\n+      blob: nextBlob,\n+    });\n+    this.load(nextBlob);\n+  }\n+\n+  componentWillUpdate(nextProps, nextState) {\n+    if (this.state.url != nextState.url) {\n+      this.releaseBlobURL();\n+    }\n+\n     const rect = ReactDOM.findDOMNode(this).parentElement.getBoundingClientRect();\n     this._parentTop = rect.top;\n     this._parentLeft = rect.left;\n   }\n \n+  getBlob(props: Props): NomsBlob {\n+    let [w, h] = props.fullscreen ?\n+      [props.viewport.clientWidth, props.viewport.clientHeight] :\n+      [props.gridSize.width, props.gridSize.height];\n+    const [_, blob] = props.photo.getBestSize(w, h);\n+    return blob;\n+  }\n+\n+  async load(blob: NomsBlob) {\n+    const b = await blob.targetValue(this.props.db);\n+    const r = b.getReader();\n+    const parts = [];\n+    while (true) {\n+      const n = await r.read();\n+\n+      // might have changed\n+      if (this.state.blob != blob) {\n+        return;\n+      }\n+\n+      if (n.value) {\n+        parts.push(n.value);\n+      }\n+      if (n.done) {\n+        break;\n+      }\n+    }\n+    this.setState({\n+      url: URL.createObjectURL(new Blob(parts)),\n+    });\n+  }\n+\n+  componentWillUnmount() {\n+    this.releaseBlobURL();\n+  }\n+\n+  releaseBlobURL() {\n+    if (this.state.url) {\n+      URL.revokeObjectURL(this.state.url);","path":"samples/js/photos/src/photo-grid-item.js","position":113,"original_position":113,"commit_id":"54c5e7324c869b9f97344d8763435d9906ec8d26","original_commit_id":"54c5e7324c869b9f97344d8763435d9906ec8d26","user":{"login":"kalman","id":657134,"avatar_url":"https://avatars.githubusercontent.com/u/657134?v=3","gravatar_id":"","url":"https://api.github.com/users/kalman","html_url":"https://github.com/kalman","followers_url":"https://api.github.com/users/kalman/followers","following_url":"https://api.github.com/users/kalman/following{/other_user}","gists_url":"https://api.github.com/users/kalman/gists{/gist_id}","starred_url":"https://api.github.com/users/kalman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kalman/subscriptions","organizations_url":"https://api.github.com/users/kalman/orgs","repos_url":"https://api.github.com/users/kalman/repos","events_url":"https://api.github.com/users/kalman/events{/privacy}","received_events_url":"https://api.github.com/users/kalman/received_events","type":"User","site_admin":false},"body":"Do you want to also clear the URL state?","created_at":"2016-11-18T17:43:32Z","updated_at":"2016-11-18T17:43:32Z","html_url":"https://github.com/attic-labs/noms/pull/2841#discussion_r88703254","pull_request_url":"https://api.github.com/repos/attic-labs/noms/pulls/2841","_links":{"self":{"href":"https://api.github.com/repos/attic-labs/noms/pulls/comments/88703254"},"html":{"href":"https://github.com/attic-labs/noms/pull/2841#discussion_r88703254"},"pull_request":{"href":"https://api.github.com/repos/attic-labs/noms/pulls/2841"}}},"pull_request":{"url":"https://api.github.com/repos/attic-labs/noms/pulls/2841","id":94314602,"html_url":"https://github.com/attic-labs/noms/pull/2841","diff_url":"https://github.com/attic-labs/noms/pull/2841.diff","patch_url":"https://github.com/attic-labs/noms/pull/2841.patch","issue_url":"https://api.github.com/repos/attic-labs/noms/issues/2841","number":2841,"state":"open","locked":false,"title":"Teach photos UI about LocalResource","user":{"login":"aboodman","id":80388,"avatar_url":"https://avatars.githubusercontent.com/u/80388?v=3","gravatar_id":"","url":"https://api.github.com/users/aboodman","html_url":"https://github.com/aboodman","followers_url":"https://api.github.com/users/aboodman/followers","following_url":"https://api.github.com/users/aboodman/following{/other_user}","gists_url":"https://api.github.com/users/aboodman/gists{/gist_id}","starred_url":"https://api.github.com/users/aboodman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aboodman/subscriptions","organizations_url":"https://api.github.com/users/aboodman/orgs","repos_url":"https://api.github.com/users/aboodman/repos","events_url":"https://api.github.com/users/aboodman/events{/privacy}","received_events_url":"https://api.github.com/users/aboodman/received_events","type":"User","site_admin":false},"body":"The animation is still not working. I temporarily disabled it. This is so finicky :-/.","created_at":"2016-11-18T07:25:31Z","updated_at":"2016-11-18T17:55:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e7de5b65c9588c298ac51c8e51a66a5ea5d36ccf","assignee":{"login":"kalman","id":657134,"avatar_url":"https://avatars.githubusercontent.com/u/657134?v=3","gravatar_id":"","url":"https://api.github.com/users/kalman","html_url":"https://github.com/kalman","followers_url":"https://api.github.com/users/kalman/followers","following_url":"https://api.github.com/users/kalman/following{/other_user}","gists_url":"https://api.github.com/users/kalman/gists{/gist_id}","starred_url":"https://api.github.com/users/kalman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kalman/subscriptions","organizations_url":"https://api.github.com/users/kalman/orgs","repos_url":"https://api.github.com/users/kalman/repos","events_url":"https://api.github.com/users/kalman/events{/privacy}","received_events_url":"https://api.github.com/users/kalman/received_events","type":"User","site_admin":false},"assignees":[{"login":"kalman","id":657134,"avatar_url":"https://avatars.githubusercontent.com/u/657134?v=3","gravatar_id":"","url":"https://api.github.com/users/kalman","html_url":"https://github.com/kalman","followers_url":"https://api.github.com/users/kalman/followers","following_url":"https://api.github.com/users/kalman/following{/other_user}","gists_url":"https://api.github.com/users/kalman/gists{/gist_id}","starred_url":"https://api.github.com/users/kalman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kalman/subscriptions","organizations_url":"https://api.github.com/users/kalman/orgs","repos_url":"https://api.github.com/users/kalman/repos","events_url":"https://api.github.com/users/kalman/events{/privacy}","received_events_url":"https://api.github.com/users/kalman/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/attic-labs/noms/pulls/2841/commits","review_comments_url":"https://api.github.com/repos/attic-labs/noms/pulls/2841/comments","review_comment_url":"https://api.github.com/repos/attic-labs/noms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/attic-labs/noms/issues/2841/comments","statuses_url":"https://api.github.com/repos/attic-labs/noms/statuses/54c5e7324c869b9f97344d8763435d9906ec8d26","head":{"label":"aboodman:ui","ref":"ui","sha":"54c5e7324c869b9f97344d8763435d9906ec8d26","user":{"login":"aboodman","id":80388,"avatar_url":"https://avatars.githubusercontent.com/u/80388?v=3","gravatar_id":"","url":"https://api.github.com/users/aboodman","html_url":"https://github.com/aboodman","followers_url":"https://api.github.com/users/aboodman/followers","following_url":"https://api.github.com/users/aboodman/following{/other_user}","gists_url":"https://api.github.com/users/aboodman/gists{/gist_id}","starred_url":"https://api.github.com/users/aboodman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aboodman/subscriptions","organizations_url":"https://api.github.com/users/aboodman/orgs","repos_url":"https://api.github.com/users/aboodman/repos","events_url":"https://api.github.com/users/aboodman/events{/privacy}","received_events_url":"https://api.github.com/users/aboodman/received_events","type":"User","site_admin":false},"repo":{"id":65707197,"name":"noms-1","full_name":"aboodman/noms-1","owner":{"login":"aboodman","id":80388,"avatar_url":"https://avatars.githubusercontent.com/u/80388?v=3","gravatar_id":"","url":"https://api.github.com/users/aboodman","html_url":"https://github.com/aboodman","followers_url":"https://api.github.com/users/aboodman/followers","following_url":"https://api.github.com/users/aboodman/following{/other_user}","gists_url":"https://api.github.com/users/aboodman/gists{/gist_id}","starred_url":"https://api.github.com/users/aboodman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aboodman/subscriptions","organizations_url":"https://api.github.com/users/aboodman/orgs","repos_url":"https://api.github.com/users/aboodman/repos","events_url":"https://api.github.com/users/aboodman/events{/privacy}","received_events_url":"https://api.github.com/users/aboodman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aboodman/noms-1","description":"The versioned, forkable, syncable database","fork":true,"url":"https://api.github.com/repos/aboodman/noms-1","forks_url":"https://api.github.com/repos/aboodman/noms-1/forks","keys_url":"https://api.github.com/repos/aboodman/noms-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aboodman/noms-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aboodman/noms-1/teams","hooks_url":"https://api.github.com/repos/aboodman/noms-1/hooks","issue_events_url":"https://api.github.com/repos/aboodman/noms-1/issues/events{/number}","events_url":"https://api.github.com/repos/aboodman/noms-1/events","assignees_url":"https://api.github.com/repos/aboodman/noms-1/assignees{/user}","branches_url":"https://api.github.com/repos/aboodman/noms-1/branches{/branch}","tags_url":"https://api.github.com/repos/aboodman/noms-1/tags","blobs_url":"https://api.github.com/repos/aboodman/noms-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aboodman/noms-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aboodman/noms-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/aboodman/noms-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aboodman/noms-1/statuses/{sha}","languages_url":"https://api.github.com/repos/aboodman/noms-1/languages","stargazers_url":"https://api.github.com/repos/aboodman/noms-1/stargazers","contributors_url":"https://api.github.com/repos/aboodman/noms-1/contributors","subscribers_url":"https://api.github.com/repos/aboodman/noms-1/subscribers","subscription_url":"https://api.github.com/repos/aboodman/noms-1/subscription","commits_url":"https://api.github.com/repos/aboodman/noms-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/aboodman/noms-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/aboodman/noms-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/aboodman/noms-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/aboodman/noms-1/contents/{+path}","compare_url":"https://api.github.com/repos/aboodman/noms-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aboodman/noms-1/merges","archive_url":"https://api.github.com/repos/aboodman/noms-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aboodman/noms-1/downloads","issues_url":"https://api.github.com/repos/aboodman/noms-1/issues{/number}","pulls_url":"https://api.github.com/repos/aboodman/noms-1/pulls{/number}","milestones_url":"https://api.github.com/repos/aboodman/noms-1/milestones{/number}","notifications_url":"https://api.github.com/repos/aboodman/noms-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aboodman/noms-1/labels{/name}","releases_url":"https://api.github.com/repos/aboodman/noms-1/releases{/id}","deployments_url":"https://api.github.com/repos/aboodman/noms-1/deployments","created_at":"2016-08-15T05:39:15Z","updated_at":"2016-08-15T05:39:18Z","pushed_at":"2016-11-18T07:22:31Z","git_url":"git://github.com/aboodman/noms-1.git","ssh_url":"git@github.com:aboodman/noms-1.git","clone_url":"https://github.com/aboodman/noms-1.git","svn_url":"https://github.com/aboodman/noms-1","homepage":"","size":27843,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"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":"attic-labs:master","ref":"master","sha":"86878936b11b0d0b28274b21f9d22489bb1a0c72","user":{"login":"attic-labs","id":12534679,"avatar_url":"https://avatars.githubusercontent.com/u/12534679?v=3","gravatar_id":"","url":"https://api.github.com/users/attic-labs","html_url":"https://github.com/attic-labs","followers_url":"https://api.github.com/users/attic-labs/followers","following_url":"https://api.github.com/users/attic-labs/following{/other_user}","gists_url":"https://api.github.com/users/attic-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/attic-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/attic-labs/subscriptions","organizations_url":"https://api.github.com/users/attic-labs/orgs","repos_url":"https://api.github.com/users/attic-labs/repos","events_url":"https://api.github.com/users/attic-labs/events{/privacy}","received_events_url":"https://api.github.com/users/attic-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":36778364,"name":"noms","full_name":"attic-labs/noms","owner":{"login":"attic-labs","id":12534679,"avatar_url":"https://avatars.githubusercontent.com/u/12534679?v=3","gravatar_id":"","url":"https://api.github.com/users/attic-labs","html_url":"https://github.com/attic-labs","followers_url":"https://api.github.com/users/attic-labs/followers","following_url":"https://api.github.com/users/attic-labs/following{/other_user}","gists_url":"https://api.github.com/users/attic-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/attic-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/attic-labs/subscriptions","organizations_url":"https://api.github.com/users/attic-labs/orgs","repos_url":"https://api.github.com/users/attic-labs/repos","events_url":"https://api.github.com/users/attic-labs/events{/privacy}","received_events_url":"https://api.github.com/users/attic-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/attic-labs/noms","description":"The versioned, forkable, syncable database","fork":false,"url":"https://api.github.com/repos/attic-labs/noms","forks_url":"https://api.github.com/repos/attic-labs/noms/forks","keys_url":"https://api.github.com/repos/attic-labs/noms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/attic-labs/noms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/attic-labs/noms/teams","hooks_url":"https://api.github.com/repos/attic-labs/noms/hooks","issue_events_url":"https://api.github.com/repos/attic-labs/noms/issues/events{/number}","events_url":"https://api.github.com/repos/attic-labs/noms/events","assignees_url":"https://api.github.com/repos/attic-labs/noms/assignees{/user}","branches_url":"https://api.github.com/repos/attic-labs/noms/branches{/branch}","tags_url":"https://api.github.com/repos/attic-labs/noms/tags","blobs_url":"https://api.github.com/repos/attic-labs/noms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/attic-labs/noms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/attic-labs/noms/git/refs{/sha}","trees_url":"https://api.github.com/repos/attic-labs/noms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/attic-labs/noms/statuses/{sha}","languages_url":"https://api.github.com/repos/attic-labs/noms/languages","stargazers_url":"https://api.github.com/repos/attic-labs/noms/stargazers","contributors_url":"https://api.github.com/repos/attic-labs/noms/contributors","subscribers_url":"https://api.github.com/repos/attic-labs/noms/subscribers","subscription_url":"https://api.github.com/repos/attic-labs/noms/subscription","commits_url":"https://api.github.com/repos/attic-labs/noms/commits{/sha}","git_commits_url":"https://api.github.com/repos/attic-labs/noms/git/commits{/sha}","comments_url":"https://api.github.com/repos/attic-labs/noms/comments{/number}","issue_comment_url":"https://api.github.com/repos/attic-labs/noms/issues/comments{/number}","contents_url":"https://api.github.com/repos/attic-labs/noms/contents/{+path}","compare_url":"https://api.github.com/repos/attic-labs/noms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/attic-labs/noms/merges","archive_url":"https://api.github.com/repos/attic-labs/noms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/attic-labs/noms/downloads","issues_url":"https://api.github.com/repos/attic-labs/noms/issues{/number}","pulls_url":"https://api.github.com/repos/attic-labs/noms/pulls{/number}","milestones_url":"https://api.github.com/repos/attic-labs/noms/milestones{/number}","notifications_url":"https://api.github.com/repos/attic-labs/noms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/attic-labs/noms/labels{/name}","releases_url":"https://api.github.com/repos/attic-labs/noms/releases{/id}","deployments_url":"https://api.github.com/repos/attic-labs/noms/deployments","created_at":"2015-06-03T03:44:49Z","updated_at":"2016-11-18T16:45:44Z","pushed_at":"2016-11-18T07:25:31Z","git_url":"git://github.com/attic-labs/noms.git","ssh_url":"git@github.com:attic-labs/noms.git","clone_url":"https://github.com/attic-labs/noms.git","svn_url":"https://github.com/attic-labs/noms","homepage":"","size":40437,"stargazers_count":5847,"watchers_count":5847,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":169,"mirror_url":null,"open_issues_count":239,"forks":169,"open_issues":239,"watchers":5847,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/attic-labs/noms/pulls/2841"},"html":{"href":"https://github.com/attic-labs/noms/pull/2841"},"issue":{"href":"https://api.github.com/repos/attic-labs/noms/issues/2841"},"comments":{"href":"https://api.github.com/repos/attic-labs/noms/issues/2841/comments"},"review_comments":{"href":"https://api.github.com/repos/attic-labs/noms/pulls/2841/comments"},"review_comment":{"href":"https://api.github.com/repos/attic-labs/noms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/attic-labs/noms/pulls/2841/commits"},"statuses":{"href":"https://api.github.com/repos/attic-labs/noms/statuses/54c5e7324c869b9f97344d8763435d9906ec8d26"}}}}
{"actor":{"display_login":"kalman"}}