{"action":"created","comment":{"url":"https://api.github.com/repos/johnpryan/redux.dart/pulls/comments/158334336","pull_request_review_id":85130539,"id":158334336,"diff_hunk":"@@ -199,23 +211,33 @@ class Store<State> {\n   // This will be called after all other middleware provided by the user have\n   // been run. Its job is simple: Run the current state through the reducer,\n   // save the result, and notify any subscribers.\n-  _reduceAndNotify(dynamic action) {\n+  void _reduceAndNotify(dynamic action) {\n     final state = reducer(_state, action);\n+\n+    if (distinct) {","path":"lib/src/store.dart","position":46,"original_position":46,"commit_id":"121deca237462634d1bfa77da18db7472c82c08d","original_commit_id":"121deca237462634d1bfa77da18db7472c82c08d","user":{"login":"brianegan","id":126604,"avatar_url":"https://avatars2.githubusercontent.com/u/126604?v=4","gravatar_id":"","url":"https://api.github.com/users/brianegan","html_url":"https://github.com/brianegan","followers_url":"https://api.github.com/users/brianegan/followers","following_url":"https://api.github.com/users/brianegan/following{/other_user}","gists_url":"https://api.github.com/users/brianegan/gists{/gist_id}","starred_url":"https://api.github.com/users/brianegan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianegan/subscriptions","organizations_url":"https://api.github.com/users/brianegan/orgs","repos_url":"https://api.github.com/users/brianegan/repos","events_url":"https://api.github.com/users/brianegan/events{/privacy}","received_events_url":"https://api.github.com/users/brianegan/received_events","type":"User","site_admin":false},"body":"\"I'm not familiar with a situation where == is slow so I suppose users can use stream.distinct at their own risk.\"\r\n\r\nIt's a fair point. The reason I thought of it: say you had a couple hundred or even a couple thousand models in your Store. That's really not too crazy -- at SoundCloud, we often held that many models in our Store (peeps have large playlists, scroll through infinite lists, etc).\r\n\r\nSeemed like an easy win in that case, but I feel like you might be a bit more suspect about adding this to the library in general? Happy to chat about that if you've got that gut feeling.\r\n\r\n-------\r\n\r\nWRT `flutter_redux` and the way distinct works for the `StoreConnector` Widget, that's handling a bit of a different case. `StoreConnector.distinct` works on the `ViewModel` returned by the `converter` function, not on the whole State tree. `flutter_redux` also uses a `StreamBuilder` under the hood to handle the subscription stuff. `StreamBuilder` works by first delivering a `Snapshot<ViewModel>` without any data, then delivers a Snapshot with data after it receives data from the Stream.\r\n\r\nSo what should be rendered before the `onChange` Stream emits something? Why not just build the `ViewModel` based on the `store.state`. However, since you can't pass that first synchronous computation to the `distinct`, I use that small workaround you found :)","created_at":"2017-12-21T17:29:19Z","updated_at":"2017-12-21T17:29:19Z","html_url":"https://github.com/johnpryan/redux.dart/pull/15#discussion_r158334336","pull_request_url":"https://api.github.com/repos/johnpryan/redux.dart/pulls/15","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/johnpryan/redux.dart/pulls/comments/158334336"},"html":{"href":"https://github.com/johnpryan/redux.dart/pull/15#discussion_r158334336"},"pull_request":{"href":"https://api.github.com/repos/johnpryan/redux.dart/pulls/15"}},"in_reply_to_id":158233949},"pull_request":{"url":"https://api.github.com/repos/johnpryan/redux.dart/pulls/15","id":159613756,"html_url":"https://github.com/johnpryan/redux.dart/pull/15","diff_url":"https://github.com/johnpryan/redux.dart/pull/15.diff","patch_url":"https://github.com/johnpryan/redux.dart/pull/15.patch","issue_url":"https://api.github.com/repos/johnpryan/redux.dart/issues/15","number":15,"state":"open","locked":false,"title":"Add `distinct` option","user":{"login":"brianegan","id":126604,"avatar_url":"https://avatars2.githubusercontent.com/u/126604?v=4","gravatar_id":"","url":"https://api.github.com/users/brianegan","html_url":"https://github.com/brianegan","followers_url":"https://api.github.com/users/brianegan/followers","following_url":"https://api.github.com/users/brianegan/following{/other_user}","gists_url":"https://api.github.com/users/brianegan/gists{/gist_id}","starred_url":"https://api.github.com/users/brianegan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianegan/subscriptions","organizations_url":"https://api.github.com/users/brianegan/orgs","repos_url":"https://api.github.com/users/brianegan/repos","events_url":"https://api.github.com/users/brianegan/events{/privacy}","received_events_url":"https://api.github.com/users/brianegan/received_events","type":"User","site_admin":false},"body":"If the `distinct` param set to true, the Store will not emit onChange events if the new State that is returned from your `reducer` in response to an Action is equal to the previous state.\r\n\r\nUnder the hood, it will use the `==` method from your State class to determine whether or not the two States are equal.\r\n\r\nFor fun, I've also added stricter analysis rules to improve the \"health\" score displayed by Pana on the Pub website, fixed a silly mistake in the README example, and updated the examples to reflect the README.\r\n\r\nExample usage: `new Store(myReducer, distinct: true);`\r\n\r\n/cc @johnbland-wf\r\n\r\nFixes #14.","created_at":"2017-12-21T09:43:21Z","updated_at":"2017-12-21T17:29:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"edd50747355d96831e4556f07f338ae03110010d","assignee":null,"assignees":[],"requested_reviewers":[{"login":"johnpryan","id":1145719,"avatar_url":"https://avatars3.githubusercontent.com/u/1145719?v=4","gravatar_id":"","url":"https://api.github.com/users/johnpryan","html_url":"https://github.com/johnpryan","followers_url":"https://api.github.com/users/johnpryan/followers","following_url":"https://api.github.com/users/johnpryan/following{/other_user}","gists_url":"https://api.github.com/users/johnpryan/gists{/gist_id}","starred_url":"https://api.github.com/users/johnpryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnpryan/subscriptions","organizations_url":"https://api.github.com/users/johnpryan/orgs","repos_url":"https://api.github.com/users/johnpryan/repos","events_url":"https://api.github.com/users/johnpryan/events{/privacy}","received_events_url":"https://api.github.com/users/johnpryan/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/johnpryan/redux.dart/pulls/15/commits","review_comments_url":"https://api.github.com/repos/johnpryan/redux.dart/pulls/15/comments","review_comment_url":"https://api.github.com/repos/johnpryan/redux.dart/pulls/comments{/number}","comments_url":"https://api.github.com/repos/johnpryan/redux.dart/issues/15/comments","statuses_url":"https://api.github.com/repos/johnpryan/redux.dart/statuses/121deca237462634d1bfa77da18db7472c82c08d","head":{"label":"johnpryan:distinct","ref":"distinct","sha":"121deca237462634d1bfa77da18db7472c82c08d","user":{"login":"johnpryan","id":1145719,"avatar_url":"https://avatars3.githubusercontent.com/u/1145719?v=4","gravatar_id":"","url":"https://api.github.com/users/johnpryan","html_url":"https://github.com/johnpryan","followers_url":"https://api.github.com/users/johnpryan/followers","following_url":"https://api.github.com/users/johnpryan/following{/other_user}","gists_url":"https://api.github.com/users/johnpryan/gists{/gist_id}","starred_url":"https://api.github.com/users/johnpryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnpryan/subscriptions","organizations_url":"https://api.github.com/users/johnpryan/orgs","repos_url":"https://api.github.com/users/johnpryan/repos","events_url":"https://api.github.com/users/johnpryan/events{/privacy}","received_events_url":"https://api.github.com/users/johnpryan/received_events","type":"User","site_admin":false},"repo":{"id":58987271,"name":"redux.dart","full_name":"johnpryan/redux.dart","owner":{"login":"johnpryan","id":1145719,"avatar_url":"https://avatars3.githubusercontent.com/u/1145719?v=4","gravatar_id":"","url":"https://api.github.com/users/johnpryan","html_url":"https://github.com/johnpryan","followers_url":"https://api.github.com/users/johnpryan/followers","following_url":"https://api.github.com/users/johnpryan/following{/other_user}","gists_url":"https://api.github.com/users/johnpryan/gists{/gist_id}","starred_url":"https://api.github.com/users/johnpryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnpryan/subscriptions","organizations_url":"https://api.github.com/users/johnpryan/orgs","repos_url":"https://api.github.com/users/johnpryan/repos","events_url":"https://api.github.com/users/johnpryan/events{/privacy}","received_events_url":"https://api.github.com/users/johnpryan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/johnpryan/redux.dart","description":"Redux for Dart","fork":false,"url":"https://api.github.com/repos/johnpryan/redux.dart","forks_url":"https://api.github.com/repos/johnpryan/redux.dart/forks","keys_url":"https://api.github.com/repos/johnpryan/redux.dart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/johnpryan/redux.dart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/johnpryan/redux.dart/teams","hooks_url":"https://api.github.com/repos/johnpryan/redux.dart/hooks","issue_events_url":"https://api.github.com/repos/johnpryan/redux.dart/issues/events{/number}","events_url":"https://api.github.com/repos/johnpryan/redux.dart/events","assignees_url":"https://api.github.com/repos/johnpryan/redux.dart/assignees{/user}","branches_url":"https://api.github.com/repos/johnpryan/redux.dart/branches{/branch}","tags_url":"https://api.github.com/repos/johnpryan/redux.dart/tags","blobs_url":"https://api.github.com/repos/johnpryan/redux.dart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/johnpryan/redux.dart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/johnpryan/redux.dart/git/refs{/sha}","trees_url":"https://api.github.com/repos/johnpryan/redux.dart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/johnpryan/redux.dart/statuses/{sha}","languages_url":"https://api.github.com/repos/johnpryan/redux.dart/languages","stargazers_url":"https://api.github.com/repos/johnpryan/redux.dart/stargazers","contributors_url":"https://api.github.com/repos/johnpryan/redux.dart/contributors","subscribers_url":"https://api.github.com/repos/johnpryan/redux.dart/subscribers","subscription_url":"https://api.github.com/repos/johnpryan/redux.dart/subscription","commits_url":"https://api.github.com/repos/johnpryan/redux.dart/commits{/sha}","git_commits_url":"https://api.github.com/repos/johnpryan/redux.dart/git/commits{/sha}","comments_url":"https://api.github.com/repos/johnpryan/redux.dart/comments{/number}","issue_comment_url":"https://api.github.com/repos/johnpryan/redux.dart/issues/comments{/number}","contents_url":"https://api.github.com/repos/johnpryan/redux.dart/contents/{+path}","compare_url":"https://api.github.com/repos/johnpryan/redux.dart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/johnpryan/redux.dart/merges","archive_url":"https://api.github.com/repos/johnpryan/redux.dart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/johnpryan/redux.dart/downloads","issues_url":"https://api.github.com/repos/johnpryan/redux.dart/issues{/number}","pulls_url":"https://api.github.com/repos/johnpryan/redux.dart/pulls{/number}","milestones_url":"https://api.github.com/repos/johnpryan/redux.dart/milestones{/number}","notifications_url":"https://api.github.com/repos/johnpryan/redux.dart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/johnpryan/redux.dart/labels{/name}","releases_url":"https://api.github.com/repos/johnpryan/redux.dart/releases{/id}","deployments_url":"https://api.github.com/repos/johnpryan/redux.dart/deployments","created_at":"2016-05-17T03:25:03Z","updated_at":"2017-12-11T06:07:33Z","pushed_at":"2017-12-21T09:43:22Z","git_url":"git://github.com/johnpryan/redux.dart.git","ssh_url":"git@github.com:johnpryan/redux.dart.git","clone_url":"https://github.com/johnpryan/redux.dart.git","svn_url":"https://github.com/johnpryan/redux.dart","homepage":"https://www.dartdocs.org/documentation/redux/latest/index.html","size":58,"stargazers_count":29,"watchers_count":29,"language":"Dart","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":4,"open_issues":1,"watchers":29,"default_branch":"master"}},"base":{"label":"johnpryan:master","ref":"master","sha":"fce89837f9d1de9d7cf713129f9e4c3c12912094","user":{"login":"johnpryan","id":1145719,"avatar_url":"https://avatars3.githubusercontent.com/u/1145719?v=4","gravatar_id":"","url":"https://api.github.com/users/johnpryan","html_url":"https://github.com/johnpryan","followers_url":"https://api.github.com/users/johnpryan/followers","following_url":"https://api.github.com/users/johnpryan/following{/other_user}","gists_url":"https://api.github.com/users/johnpryan/gists{/gist_id}","starred_url":"https://api.github.com/users/johnpryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnpryan/subscriptions","organizations_url":"https://api.github.com/users/johnpryan/orgs","repos_url":"https://api.github.com/users/johnpryan/repos","events_url":"https://api.github.com/users/johnpryan/events{/privacy}","received_events_url":"https://api.github.com/users/johnpryan/received_events","type":"User","site_admin":false},"repo":{"id":58987271,"name":"redux.dart","full_name":"johnpryan/redux.dart","owner":{"login":"johnpryan","id":1145719,"avatar_url":"https://avatars3.githubusercontent.com/u/1145719?v=4","gravatar_id":"","url":"https://api.github.com/users/johnpryan","html_url":"https://github.com/johnpryan","followers_url":"https://api.github.com/users/johnpryan/followers","following_url":"https://api.github.com/users/johnpryan/following{/other_user}","gists_url":"https://api.github.com/users/johnpryan/gists{/gist_id}","starred_url":"https://api.github.com/users/johnpryan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnpryan/subscriptions","organizations_url":"https://api.github.com/users/johnpryan/orgs","repos_url":"https://api.github.com/users/johnpryan/repos","events_url":"https://api.github.com/users/johnpryan/events{/privacy}","received_events_url":"https://api.github.com/users/johnpryan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/johnpryan/redux.dart","description":"Redux for Dart","fork":false,"url":"https://api.github.com/repos/johnpryan/redux.dart","forks_url":"https://api.github.com/repos/johnpryan/redux.dart/forks","keys_url":"https://api.github.com/repos/johnpryan/redux.dart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/johnpryan/redux.dart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/johnpryan/redux.dart/teams","hooks_url":"https://api.github.com/repos/johnpryan/redux.dart/hooks","issue_events_url":"https://api.github.com/repos/johnpryan/redux.dart/issues/events{/number}","events_url":"https://api.github.com/repos/johnpryan/redux.dart/events","assignees_url":"https://api.github.com/repos/johnpryan/redux.dart/assignees{/user}","branches_url":"https://api.github.com/repos/johnpryan/redux.dart/branches{/branch}","tags_url":"https://api.github.com/repos/johnpryan/redux.dart/tags","blobs_url":"https://api.github.com/repos/johnpryan/redux.dart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/johnpryan/redux.dart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/johnpryan/redux.dart/git/refs{/sha}","trees_url":"https://api.github.com/repos/johnpryan/redux.dart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/johnpryan/redux.dart/statuses/{sha}","languages_url":"https://api.github.com/repos/johnpryan/redux.dart/languages","stargazers_url":"https://api.github.com/repos/johnpryan/redux.dart/stargazers","contributors_url":"https://api.github.com/repos/johnpryan/redux.dart/contributors","subscribers_url":"https://api.github.com/repos/johnpryan/redux.dart/subscribers","subscription_url":"https://api.github.com/repos/johnpryan/redux.dart/subscription","commits_url":"https://api.github.com/repos/johnpryan/redux.dart/commits{/sha}","git_commits_url":"https://api.github.com/repos/johnpryan/redux.dart/git/commits{/sha}","comments_url":"https://api.github.com/repos/johnpryan/redux.dart/comments{/number}","issue_comment_url":"https://api.github.com/repos/johnpryan/redux.dart/issues/comments{/number}","contents_url":"https://api.github.com/repos/johnpryan/redux.dart/contents/{+path}","compare_url":"https://api.github.com/repos/johnpryan/redux.dart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/johnpryan/redux.dart/merges","archive_url":"https://api.github.com/repos/johnpryan/redux.dart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/johnpryan/redux.dart/downloads","issues_url":"https://api.github.com/repos/johnpryan/redux.dart/issues{/number}","pulls_url":"https://api.github.com/repos/johnpryan/redux.dart/pulls{/number}","milestones_url":"https://api.github.com/repos/johnpryan/redux.dart/milestones{/number}","notifications_url":"https://api.github.com/repos/johnpryan/redux.dart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/johnpryan/redux.dart/labels{/name}","releases_url":"https://api.github.com/repos/johnpryan/redux.dart/releases{/id}","deployments_url":"https://api.github.com/repos/johnpryan/redux.dart/deployments","created_at":"2016-05-17T03:25:03Z","updated_at":"2017-12-11T06:07:33Z","pushed_at":"2017-12-21T09:43:22Z","git_url":"git://github.com/johnpryan/redux.dart.git","ssh_url":"git@github.com:johnpryan/redux.dart.git","clone_url":"https://github.com/johnpryan/redux.dart.git","svn_url":"https://github.com/johnpryan/redux.dart","homepage":"https://www.dartdocs.org/documentation/redux/latest/index.html","size":58,"stargazers_count":29,"watchers_count":29,"language":"Dart","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":4,"open_issues":1,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/johnpryan/redux.dart/pulls/15"},"html":{"href":"https://github.com/johnpryan/redux.dart/pull/15"},"issue":{"href":"https://api.github.com/repos/johnpryan/redux.dart/issues/15"},"comments":{"href":"https://api.github.com/repos/johnpryan/redux.dart/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/johnpryan/redux.dart/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/johnpryan/redux.dart/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/johnpryan/redux.dart/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/johnpryan/redux.dart/statuses/121deca237462634d1bfa77da18db7472c82c08d"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"brianegan"}}