{"action":"closed","number":688,"pull_request":{"url":"https://api.github.com/repos/redux-saga/redux-saga/pulls/688","id":97547716,"node_id":"MDExOlB1bGxSZXF1ZXN0OTc1NDc3MTY=","html_url":"https://github.com/redux-saga/redux-saga/pull/688","diff_url":"https://github.com/redux-saga/redux-saga/pull/688.diff","patch_url":"https://github.com/redux-saga/redux-saga/pull/688.patch","issue_url":"https://api.github.com/repos/redux-saga/redux-saga/issues/688","number":688,"state":"closed","locked":false,"title":"Added debounce helper","user":{"login":"Andarist","id":9800850,"node_id":"MDQ6VXNlcjk4MDA4NTA=","avatar_url":"https://avatars2.githubusercontent.com/u/9800850?v=4","gravatar_id":"","url":"https://api.github.com/users/Andarist","html_url":"https://github.com/Andarist","followers_url":"https://api.github.com/users/Andarist/followers","following_url":"https://api.github.com/users/Andarist/following{/other_user}","gists_url":"https://api.github.com/users/Andarist/gists{/gist_id}","starred_url":"https://api.github.com/users/Andarist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Andarist/subscriptions","organizations_url":"https://api.github.com/users/Andarist/orgs","repos_url":"https://api.github.com/users/Andarist/repos","events_url":"https://api.github.com/users/Andarist/events{/privacy}","received_events_url":"https://api.github.com/users/Andarist/received_events","type":"User","site_admin":false},"body":"it should be roughly equivalent of:\r\n```javascript\r\nfunction* debounce(ms, pattern, worker, ...args) {\r\n\tlet action\r\n\tconst setAction = ac => action = ac\r\n\r\n\twhile (true) {\r\n\t\tsetAction( yield take(pattern) )\r\n\r\n\t\twhile (true) {\r\n\t\t\tconst { debounced, _action } = yield race({\r\n\t\t\t\tdebounced: call(delay, ms),\r\n\t\t\t\t_action: take(pattern)\r\n\t\t\t})\r\n\r\n\t\t\tif (debounced) {\r\n\t\t\t\tyield fork(worker, ...args, ac)\r\n\t\t\t\tbreak\r\n\t\t\t}\r\n\r\n\t\t\tsetAction(_action)\r\n\t\t}\r\n\t}\r\n}\r\n```\r\n\r\nIn my reasoning this type (forking) of debouncing versus `takeLatest` + `delay` on the beginning is more appropriate for general use cases. As it wont interrupt the asynchronous forked task in the middle which could potentially land the user in some inconsistent state. WDYT?\r\n\r\nI see `takeLatest` + `delay` as other useful pattern to use, but the one that shouldnt be labeled as `debounce`.\r\n\r\nAlso I didnt write tests for it as this one https://github.com/yelouafi/redux-saga/issues/582 should be fixed first, cause `debounce` is ofc time-dependant.\r\n\r\nIn addition I've tried to simplify helpers creation and moved `END` handling to the `fsmIterator`, but it still stays an open question and the thing to be tested and checked. ","created_at":"2016-12-12T12:53:59Z","updated_at":"2018-06-05T08:50:40Z","closed_at":"2018-06-05T08:50:40Z","merged_at":null,"merge_commit_sha":"9955a9de9b5d36c7ac1bb16bdf399bf3b640bab4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/redux-saga/redux-saga/pulls/688/commits","review_comments_url":"https://api.github.com/repos/redux-saga/redux-saga/pulls/688/comments","review_comment_url":"https://api.github.com/repos/redux-saga/redux-saga/pulls/comments{/number}","comments_url":"https://api.github.com/repos/redux-saga/redux-saga/issues/688/comments","statuses_url":"https://api.github.com/repos/redux-saga/redux-saga/statuses/2292be7a4038a3ebc60f1b90ec8d90cd0ee30ba2","head":{"label":"redux-saga:debounce","ref":"debounce","sha":"2292be7a4038a3ebc60f1b90ec8d90cd0ee30ba2","user":{"login":"redux-saga","id":24776643,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0Nzc2NjQz","avatar_url":"https://avatars2.githubusercontent.com/u/24776643?v=4","gravatar_id":"","url":"https://api.github.com/users/redux-saga","html_url":"https://github.com/redux-saga","followers_url":"https://api.github.com/users/redux-saga/followers","following_url":"https://api.github.com/users/redux-saga/following{/other_user}","gists_url":"https://api.github.com/users/redux-saga/gists{/gist_id}","starred_url":"https://api.github.com/users/redux-saga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redux-saga/subscriptions","organizations_url":"https://api.github.com/users/redux-saga/orgs","repos_url":"https://api.github.com/users/redux-saga/repos","events_url":"https://api.github.com/users/redux-saga/events{/privacy}","received_events_url":"https://api.github.com/users/redux-saga/received_events","type":"Organization","site_admin":false},"repo":{"id":47071941,"node_id":"MDEwOlJlcG9zaXRvcnk0NzA3MTk0MQ==","name":"redux-saga","full_name":"redux-saga/redux-saga","owner":{"login":"redux-saga","id":24776643,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0Nzc2NjQz","avatar_url":"https://avatars2.githubusercontent.com/u/24776643?v=4","gravatar_id":"","url":"https://api.github.com/users/redux-saga","html_url":"https://github.com/redux-saga","followers_url":"https://api.github.com/users/redux-saga/followers","following_url":"https://api.github.com/users/redux-saga/following{/other_user}","gists_url":"https://api.github.com/users/redux-saga/gists{/gist_id}","starred_url":"https://api.github.com/users/redux-saga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redux-saga/subscriptions","organizations_url":"https://api.github.com/users/redux-saga/orgs","repos_url":"https://api.github.com/users/redux-saga/repos","events_url":"https://api.github.com/users/redux-saga/events{/privacy}","received_events_url":"https://api.github.com/users/redux-saga/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/redux-saga/redux-saga","description":"An alternative side effect model for Redux apps","fork":false,"url":"https://api.github.com/repos/redux-saga/redux-saga","forks_url":"https://api.github.com/repos/redux-saga/redux-saga/forks","keys_url":"https://api.github.com/repos/redux-saga/redux-saga/keys{/key_id}","collaborators_url":"https://api.github.com/repos/redux-saga/redux-saga/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/redux-saga/redux-saga/teams","hooks_url":"https://api.github.com/repos/redux-saga/redux-saga/hooks","issue_events_url":"https://api.github.com/repos/redux-saga/redux-saga/issues/events{/number}","events_url":"https://api.github.com/repos/redux-saga/redux-saga/events","assignees_url":"https://api.github.com/repos/redux-saga/redux-saga/assignees{/user}","branches_url":"https://api.github.com/repos/redux-saga/redux-saga/branches{/branch}","tags_url":"https://api.github.com/repos/redux-saga/redux-saga/tags","blobs_url":"https://api.github.com/repos/redux-saga/redux-saga/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/redux-saga/redux-saga/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/redux-saga/redux-saga/git/refs{/sha}","trees_url":"https://api.github.com/repos/redux-saga/redux-saga/git/trees{/sha}","statuses_url":"https://api.github.com/repos/redux-saga/redux-saga/statuses/{sha}","languages_url":"https://api.github.com/repos/redux-saga/redux-saga/languages","stargazers_url":"https://api.github.com/repos/redux-saga/redux-saga/stargazers","contributors_url":"https://api.github.com/repos/redux-saga/redux-saga/contributors","subscribers_url":"https://api.github.com/repos/redux-saga/redux-saga/subscribers","subscription_url":"https://api.github.com/repos/redux-saga/redux-saga/subscription","commits_url":"https://api.github.com/repos/redux-saga/redux-saga/commits{/sha}","git_commits_url":"https://api.github.com/repos/redux-saga/redux-saga/git/commits{/sha}","comments_url":"https://api.github.com/repos/redux-saga/redux-saga/comments{/number}","issue_comment_url":"https://api.github.com/repos/redux-saga/redux-saga/issues/comments{/number}","contents_url":"https://api.github.com/repos/redux-saga/redux-saga/contents/{+path}","compare_url":"https://api.github.com/repos/redux-saga/redux-saga/compare/{base}...{head}","merges_url":"https://api.github.com/repos/redux-saga/redux-saga/merges","archive_url":"https://api.github.com/repos/redux-saga/redux-saga/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/redux-saga/redux-saga/downloads","issues_url":"https://api.github.com/repos/redux-saga/redux-saga/issues{/number}","pulls_url":"https://api.github.com/repos/redux-saga/redux-saga/pulls{/number}","milestones_url":"https://api.github.com/repos/redux-saga/redux-saga/milestones{/number}","notifications_url":"https://api.github.com/repos/redux-saga/redux-saga/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/redux-saga/redux-saga/labels{/name}","releases_url":"https://api.github.com/repos/redux-saga/redux-saga/releases{/id}","deployments_url":"https://api.github.com/repos/redux-saga/redux-saga/deployments","created_at":"2015-11-29T16:58:12Z","updated_at":"2018-06-05T08:49:29Z","pushed_at":"2018-06-05T08:49:37Z","git_url":"git://github.com/redux-saga/redux-saga.git","ssh_url":"git@github.com:redux-saga/redux-saga.git","clone_url":"https://github.com/redux-saga/redux-saga.git","svn_url":"https://github.com/redux-saga/redux-saga","homepage":"https://redux-saga.js.org/","size":6391,"stargazers_count":13605,"watchers_count":13605,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1136,"mirror_url":null,"archived":false,"open_issues_count":124,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1136,"open_issues":124,"watchers":13605,"default_branch":"master"}},"base":{"label":"redux-saga:master","ref":"master","sha":"9870e4ae2827c0aa38ff5eacb97298983022d090","user":{"login":"redux-saga","id":24776643,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0Nzc2NjQz","avatar_url":"https://avatars2.githubusercontent.com/u/24776643?v=4","gravatar_id":"","url":"https://api.github.com/users/redux-saga","html_url":"https://github.com/redux-saga","followers_url":"https://api.github.com/users/redux-saga/followers","following_url":"https://api.github.com/users/redux-saga/following{/other_user}","gists_url":"https://api.github.com/users/redux-saga/gists{/gist_id}","starred_url":"https://api.github.com/users/redux-saga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redux-saga/subscriptions","organizations_url":"https://api.github.com/users/redux-saga/orgs","repos_url":"https://api.github.com/users/redux-saga/repos","events_url":"https://api.github.com/users/redux-saga/events{/privacy}","received_events_url":"https://api.github.com/users/redux-saga/received_events","type":"Organization","site_admin":false},"repo":{"id":47071941,"node_id":"MDEwOlJlcG9zaXRvcnk0NzA3MTk0MQ==","name":"redux-saga","full_name":"redux-saga/redux-saga","owner":{"login":"redux-saga","id":24776643,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI0Nzc2NjQz","avatar_url":"https://avatars2.githubusercontent.com/u/24776643?v=4","gravatar_id":"","url":"https://api.github.com/users/redux-saga","html_url":"https://github.com/redux-saga","followers_url":"https://api.github.com/users/redux-saga/followers","following_url":"https://api.github.com/users/redux-saga/following{/other_user}","gists_url":"https://api.github.com/users/redux-saga/gists{/gist_id}","starred_url":"https://api.github.com/users/redux-saga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redux-saga/subscriptions","organizations_url":"https://api.github.com/users/redux-saga/orgs","repos_url":"https://api.github.com/users/redux-saga/repos","events_url":"https://api.github.com/users/redux-saga/events{/privacy}","received_events_url":"https://api.github.com/users/redux-saga/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/redux-saga/redux-saga","description":"An alternative side effect model for Redux apps","fork":false,"url":"https://api.github.com/repos/redux-saga/redux-saga","forks_url":"https://api.github.com/repos/redux-saga/redux-saga/forks","keys_url":"https://api.github.com/repos/redux-saga/redux-saga/keys{/key_id}","collaborators_url":"https://api.github.com/repos/redux-saga/redux-saga/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/redux-saga/redux-saga/teams","hooks_url":"https://api.github.com/repos/redux-saga/redux-saga/hooks","issue_events_url":"https://api.github.com/repos/redux-saga/redux-saga/issues/events{/number}","events_url":"https://api.github.com/repos/redux-saga/redux-saga/events","assignees_url":"https://api.github.com/repos/redux-saga/redux-saga/assignees{/user}","branches_url":"https://api.github.com/repos/redux-saga/redux-saga/branches{/branch}","tags_url":"https://api.github.com/repos/redux-saga/redux-saga/tags","blobs_url":"https://api.github.com/repos/redux-saga/redux-saga/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/redux-saga/redux-saga/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/redux-saga/redux-saga/git/refs{/sha}","trees_url":"https://api.github.com/repos/redux-saga/redux-saga/git/trees{/sha}","statuses_url":"https://api.github.com/repos/redux-saga/redux-saga/statuses/{sha}","languages_url":"https://api.github.com/repos/redux-saga/redux-saga/languages","stargazers_url":"https://api.github.com/repos/redux-saga/redux-saga/stargazers","contributors_url":"https://api.github.com/repos/redux-saga/redux-saga/contributors","subscribers_url":"https://api.github.com/repos/redux-saga/redux-saga/subscribers","subscription_url":"https://api.github.com/repos/redux-saga/redux-saga/subscription","commits_url":"https://api.github.com/repos/redux-saga/redux-saga/commits{/sha}","git_commits_url":"https://api.github.com/repos/redux-saga/redux-saga/git/commits{/sha}","comments_url":"https://api.github.com/repos/redux-saga/redux-saga/comments{/number}","issue_comment_url":"https://api.github.com/repos/redux-saga/redux-saga/issues/comments{/number}","contents_url":"https://api.github.com/repos/redux-saga/redux-saga/contents/{+path}","compare_url":"https://api.github.com/repos/redux-saga/redux-saga/compare/{base}...{head}","merges_url":"https://api.github.com/repos/redux-saga/redux-saga/merges","archive_url":"https://api.github.com/repos/redux-saga/redux-saga/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/redux-saga/redux-saga/downloads","issues_url":"https://api.github.com/repos/redux-saga/redux-saga/issues{/number}","pulls_url":"https://api.github.com/repos/redux-saga/redux-saga/pulls{/number}","milestones_url":"https://api.github.com/repos/redux-saga/redux-saga/milestones{/number}","notifications_url":"https://api.github.com/repos/redux-saga/redux-saga/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/redux-saga/redux-saga/labels{/name}","releases_url":"https://api.github.com/repos/redux-saga/redux-saga/releases{/id}","deployments_url":"https://api.github.com/repos/redux-saga/redux-saga/deployments","created_at":"2015-11-29T16:58:12Z","updated_at":"2018-06-05T08:49:29Z","pushed_at":"2018-06-05T08:49:37Z","git_url":"git://github.com/redux-saga/redux-saga.git","ssh_url":"git@github.com:redux-saga/redux-saga.git","clone_url":"https://github.com/redux-saga/redux-saga.git","svn_url":"https://github.com/redux-saga/redux-saga","homepage":"https://redux-saga.js.org/","size":6391,"stargazers_count":13605,"watchers_count":13605,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1136,"mirror_url":null,"archived":false,"open_issues_count":124,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1136,"open_issues":124,"watchers":13605,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/redux-saga/redux-saga/pulls/688"},"html":{"href":"https://github.com/redux-saga/redux-saga/pull/688"},"issue":{"href":"https://api.github.com/repos/redux-saga/redux-saga/issues/688"},"comments":{"href":"https://api.github.com/repos/redux-saga/redux-saga/issues/688/comments"},"review_comments":{"href":"https://api.github.com/repos/redux-saga/redux-saga/pulls/688/comments"},"review_comment":{"href":"https://api.github.com/repos/redux-saga/redux-saga/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/redux-saga/redux-saga/pulls/688/commits"},"statuses":{"href":"https://api.github.com/repos/redux-saga/redux-saga/statuses/2292be7a4038a3ebc60f1b90ec8d90cd0ee30ba2"}},"author_association":"MEMBER","merged":false,"mergeable":false,"rebaseable":false,"mergeable_state":"dirty","merged_by":null,"comments":8,"review_comments":1,"maintainer_can_modify":false,"commits":1,"additions":53,"deletions":24,"changed_files":5}}
{"actor":{"display_login":"restrry"}}