{"action":"created","comment":{"url":"https://api.github.com/repos/Roblox/rodux/pulls/comments/173333350","pull_request_review_id":102509117,"id":173333350,"diff_hunk":"@@ -0,0 +1,17 @@\n+--[[\n+\tA middleware that allows for functions to be dispatched.\n+\tFunctions will receive a single argument, the store itself.\n+\tThis middleware consumes the function; middleware further down the chain\n+\twill not receive it.\n+]]\n+local function thunkMiddleware(next)\n+\treturn function(store, action)\n+\t\tif typeof(action) == \"function\" then\n+\t\t\taction(store)","path":"lib/thunkMiddleware.lua","position":10,"original_position":10,"commit_id":"43bb2ce40e74573191bd9087d3291f0cff7e5dd6","original_commit_id":"43bb2ce40e74573191bd9087d3291f0cff7e5dd6","user":{"login":"LPGhatguy","id":654598,"avatar_url":"https://avatars3.githubusercontent.com/u/654598?v=4","gravatar_id":"","url":"https://api.github.com/users/LPGhatguy","html_url":"https://github.com/LPGhatguy","followers_url":"https://api.github.com/users/LPGhatguy/followers","following_url":"https://api.github.com/users/LPGhatguy/following{/other_user}","gists_url":"https://api.github.com/users/LPGhatguy/gists{/gist_id}","starred_url":"https://api.github.com/users/LPGhatguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LPGhatguy/subscriptions","organizations_url":"https://api.github.com/users/LPGhatguy/orgs","repos_url":"https://api.github.com/users/LPGhatguy/repos","events_url":"https://api.github.com/users/LPGhatguy/events{/privacy}","received_events_url":"https://api.github.com/users/LPGhatguy/received_events","type":"User","site_admin":false},"body":"We should make sure to return the value that `action` returns here, and write a test for it.\r\n\r\nWith Redux thunks, it's common to return a Promise, which gets passed back to whoever dispatched the action.\r\n\r\n```lua\r\nstore:dispatch(someAsync())\r\n    :andThen(function(result)\r\n        print(\"My async action completed!\")\r\n    end)\r\n```\r\n\r\nWe might have to tweak the middleware implementation (and potentially the loggerMiddleware) to support this case, as well!","created_at":"2018-03-09T00:18:43Z","updated_at":"2018-03-09T00:18:43Z","html_url":"https://github.com/Roblox/rodux/pull/17#discussion_r173333350","pull_request_url":"https://api.github.com/repos/Roblox/rodux/pulls/17","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/Roblox/rodux/pulls/comments/173333350"},"html":{"href":"https://github.com/Roblox/rodux/pull/17#discussion_r173333350"},"pull_request":{"href":"https://api.github.com/repos/Roblox/rodux/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/Roblox/rodux/pulls/17","id":173830558,"html_url":"https://github.com/Roblox/rodux/pull/17","diff_url":"https://github.com/Roblox/rodux/pull/17.diff","patch_url":"https://github.com/Roblox/rodux/pull/17.patch","issue_url":"https://api.github.com/repos/Roblox/rodux/issues/17","number":17,"state":"open","locked":false,"title":"Move thunks out of Store","user":{"login":"AmaranthineCodices","id":31936135,"avatar_url":"https://avatars2.githubusercontent.com/u/31936135?v=4","gravatar_id":"","url":"https://api.github.com/users/AmaranthineCodices","html_url":"https://github.com/AmaranthineCodices","followers_url":"https://api.github.com/users/AmaranthineCodices/followers","following_url":"https://api.github.com/users/AmaranthineCodices/following{/other_user}","gists_url":"https://api.github.com/users/AmaranthineCodices/gists{/gist_id}","starred_url":"https://api.github.com/users/AmaranthineCodices/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmaranthineCodices/subscriptions","organizations_url":"https://api.github.com/users/AmaranthineCodices/orgs","repos_url":"https://api.github.com/users/AmaranthineCodices/repos","events_url":"https://api.github.com/users/AmaranthineCodices/events{/privacy}","received_events_url":"https://api.github.com/users/AmaranthineCodices/received_events","type":"User","site_admin":false},"body":"This moves thunks out of the main `Store` dispatch method and into a middleware; it fixes #14. The thunk middleware functions exactly as the original behavior did, and is exposed as `Rodux.thunkMiddleware`. It can be used directly:\r\n\r\n```lua\r\nRodux.Store.new(reducer, initialState, { Rodux.thunkMiddleware })\r\n```","created_at":"2018-03-08T19:40:29Z","updated_at":"2018-03-09T00:18:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"35b0e04c725ba1b8f8fa9b33ffadf2e6badb96ac","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Roblox/rodux/pulls/17/commits","review_comments_url":"https://api.github.com/repos/Roblox/rodux/pulls/17/comments","review_comment_url":"https://api.github.com/repos/Roblox/rodux/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Roblox/rodux/issues/17/comments","statuses_url":"https://api.github.com/repos/Roblox/rodux/statuses/43bb2ce40e74573191bd9087d3291f0cff7e5dd6","head":{"label":"AmaranthineCodices:thunk-middleware","ref":"thunk-middleware","sha":"43bb2ce40e74573191bd9087d3291f0cff7e5dd6","user":{"login":"AmaranthineCodices","id":31936135,"avatar_url":"https://avatars2.githubusercontent.com/u/31936135?v=4","gravatar_id":"","url":"https://api.github.com/users/AmaranthineCodices","html_url":"https://github.com/AmaranthineCodices","followers_url":"https://api.github.com/users/AmaranthineCodices/followers","following_url":"https://api.github.com/users/AmaranthineCodices/following{/other_user}","gists_url":"https://api.github.com/users/AmaranthineCodices/gists{/gist_id}","starred_url":"https://api.github.com/users/AmaranthineCodices/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmaranthineCodices/subscriptions","organizations_url":"https://api.github.com/users/AmaranthineCodices/orgs","repos_url":"https://api.github.com/users/AmaranthineCodices/repos","events_url":"https://api.github.com/users/AmaranthineCodices/events{/privacy}","received_events_url":"https://api.github.com/users/AmaranthineCodices/received_events","type":"User","site_admin":false},"repo":{"id":123653328,"name":"rodux","full_name":"AmaranthineCodices/rodux","owner":{"login":"AmaranthineCodices","id":31936135,"avatar_url":"https://avatars2.githubusercontent.com/u/31936135?v=4","gravatar_id":"","url":"https://api.github.com/users/AmaranthineCodices","html_url":"https://github.com/AmaranthineCodices","followers_url":"https://api.github.com/users/AmaranthineCodices/followers","following_url":"https://api.github.com/users/AmaranthineCodices/following{/other_user}","gists_url":"https://api.github.com/users/AmaranthineCodices/gists{/gist_id}","starred_url":"https://api.github.com/users/AmaranthineCodices/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmaranthineCodices/subscriptions","organizations_url":"https://api.github.com/users/AmaranthineCodices/orgs","repos_url":"https://api.github.com/users/AmaranthineCodices/repos","events_url":"https://api.github.com/users/AmaranthineCodices/events{/privacy}","received_events_url":"https://api.github.com/users/AmaranthineCodices/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AmaranthineCodices/rodux","description":"A state management library for Roblox Lua inspired by Redux","fork":true,"url":"https://api.github.com/repos/AmaranthineCodices/rodux","forks_url":"https://api.github.com/repos/AmaranthineCodices/rodux/forks","keys_url":"https://api.github.com/repos/AmaranthineCodices/rodux/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AmaranthineCodices/rodux/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AmaranthineCodices/rodux/teams","hooks_url":"https://api.github.com/repos/AmaranthineCodices/rodux/hooks","issue_events_url":"https://api.github.com/repos/AmaranthineCodices/rodux/issues/events{/number}","events_url":"https://api.github.com/repos/AmaranthineCodices/rodux/events","assignees_url":"https://api.github.com/repos/AmaranthineCodices/rodux/assignees{/user}","branches_url":"https://api.github.com/repos/AmaranthineCodices/rodux/branches{/branch}","tags_url":"https://api.github.com/repos/AmaranthineCodices/rodux/tags","blobs_url":"https://api.github.com/repos/AmaranthineCodices/rodux/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AmaranthineCodices/rodux/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AmaranthineCodices/rodux/git/refs{/sha}","trees_url":"https://api.github.com/repos/AmaranthineCodices/rodux/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AmaranthineCodices/rodux/statuses/{sha}","languages_url":"https://api.github.com/repos/AmaranthineCodices/rodux/languages","stargazers_url":"https://api.github.com/repos/AmaranthineCodices/rodux/stargazers","contributors_url":"https://api.github.com/repos/AmaranthineCodices/rodux/contributors","subscribers_url":"https://api.github.com/repos/AmaranthineCodices/rodux/subscribers","subscription_url":"https://api.github.com/repos/AmaranthineCodices/rodux/subscription","commits_url":"https://api.github.com/repos/AmaranthineCodices/rodux/commits{/sha}","git_commits_url":"https://api.github.com/repos/AmaranthineCodices/rodux/git/commits{/sha}","comments_url":"https://api.github.com/repos/AmaranthineCodices/rodux/comments{/number}","issue_comment_url":"https://api.github.com/repos/AmaranthineCodices/rodux/issues/comments{/number}","contents_url":"https://api.github.com/repos/AmaranthineCodices/rodux/contents/{+path}","compare_url":"https://api.github.com/repos/AmaranthineCodices/rodux/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AmaranthineCodices/rodux/merges","archive_url":"https://api.github.com/repos/AmaranthineCodices/rodux/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AmaranthineCodices/rodux/downloads","issues_url":"https://api.github.com/repos/AmaranthineCodices/rodux/issues{/number}","pulls_url":"https://api.github.com/repos/AmaranthineCodices/rodux/pulls{/number}","milestones_url":"https://api.github.com/repos/AmaranthineCodices/rodux/milestones{/number}","notifications_url":"https://api.github.com/repos/AmaranthineCodices/rodux/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AmaranthineCodices/rodux/labels{/name}","releases_url":"https://api.github.com/repos/AmaranthineCodices/rodux/releases{/id}","deployments_url":"https://api.github.com/repos/AmaranthineCodices/rodux/deployments","created_at":"2018-03-03T02:52:14Z","updated_at":"2018-03-03T02:52:15Z","pushed_at":"2018-03-09T00:08:01Z","git_url":"git://github.com/AmaranthineCodices/rodux.git","ssh_url":"git@github.com:AmaranthineCodices/rodux.git","clone_url":"https://github.com/AmaranthineCodices/rodux.git","svn_url":"https://github.com/AmaranthineCodices/rodux","homepage":"","size":71,"stargazers_count":0,"watchers_count":0,"language":"Lua","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":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Roblox:master","ref":"master","sha":"400422a146f00259540698b7405c6c0779f9d269","user":{"login":"Roblox","id":4195619,"avatar_url":"https://avatars2.githubusercontent.com/u/4195619?v=4","gravatar_id":"","url":"https://api.github.com/users/Roblox","html_url":"https://github.com/Roblox","followers_url":"https://api.github.com/users/Roblox/followers","following_url":"https://api.github.com/users/Roblox/following{/other_user}","gists_url":"https://api.github.com/users/Roblox/gists{/gist_id}","starred_url":"https://api.github.com/users/Roblox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Roblox/subscriptions","organizations_url":"https://api.github.com/users/Roblox/orgs","repos_url":"https://api.github.com/users/Roblox/repos","events_url":"https://api.github.com/users/Roblox/events{/privacy}","received_events_url":"https://api.github.com/users/Roblox/received_events","type":"Organization","site_admin":false},"repo":{"id":106594329,"name":"rodux","full_name":"Roblox/rodux","owner":{"login":"Roblox","id":4195619,"avatar_url":"https://avatars2.githubusercontent.com/u/4195619?v=4","gravatar_id":"","url":"https://api.github.com/users/Roblox","html_url":"https://github.com/Roblox","followers_url":"https://api.github.com/users/Roblox/followers","following_url":"https://api.github.com/users/Roblox/following{/other_user}","gists_url":"https://api.github.com/users/Roblox/gists{/gist_id}","starred_url":"https://api.github.com/users/Roblox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Roblox/subscriptions","organizations_url":"https://api.github.com/users/Roblox/orgs","repos_url":"https://api.github.com/users/Roblox/repos","events_url":"https://api.github.com/users/Roblox/events{/privacy}","received_events_url":"https://api.github.com/users/Roblox/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Roblox/rodux","description":"A state management library for Roblox Lua inspired by Redux","fork":false,"url":"https://api.github.com/repos/Roblox/rodux","forks_url":"https://api.github.com/repos/Roblox/rodux/forks","keys_url":"https://api.github.com/repos/Roblox/rodux/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Roblox/rodux/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Roblox/rodux/teams","hooks_url":"https://api.github.com/repos/Roblox/rodux/hooks","issue_events_url":"https://api.github.com/repos/Roblox/rodux/issues/events{/number}","events_url":"https://api.github.com/repos/Roblox/rodux/events","assignees_url":"https://api.github.com/repos/Roblox/rodux/assignees{/user}","branches_url":"https://api.github.com/repos/Roblox/rodux/branches{/branch}","tags_url":"https://api.github.com/repos/Roblox/rodux/tags","blobs_url":"https://api.github.com/repos/Roblox/rodux/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Roblox/rodux/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Roblox/rodux/git/refs{/sha}","trees_url":"https://api.github.com/repos/Roblox/rodux/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Roblox/rodux/statuses/{sha}","languages_url":"https://api.github.com/repos/Roblox/rodux/languages","stargazers_url":"https://api.github.com/repos/Roblox/rodux/stargazers","contributors_url":"https://api.github.com/repos/Roblox/rodux/contributors","subscribers_url":"https://api.github.com/repos/Roblox/rodux/subscribers","subscription_url":"https://api.github.com/repos/Roblox/rodux/subscription","commits_url":"https://api.github.com/repos/Roblox/rodux/commits{/sha}","git_commits_url":"https://api.github.com/repos/Roblox/rodux/git/commits{/sha}","comments_url":"https://api.github.com/repos/Roblox/rodux/comments{/number}","issue_comment_url":"https://api.github.com/repos/Roblox/rodux/issues/comments{/number}","contents_url":"https://api.github.com/repos/Roblox/rodux/contents/{+path}","compare_url":"https://api.github.com/repos/Roblox/rodux/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Roblox/rodux/merges","archive_url":"https://api.github.com/repos/Roblox/rodux/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Roblox/rodux/downloads","issues_url":"https://api.github.com/repos/Roblox/rodux/issues{/number}","pulls_url":"https://api.github.com/repos/Roblox/rodux/pulls{/number}","milestones_url":"https://api.github.com/repos/Roblox/rodux/milestones{/number}","notifications_url":"https://api.github.com/repos/Roblox/rodux/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Roblox/rodux/labels{/name}","releases_url":"https://api.github.com/repos/Roblox/rodux/releases{/id}","deployments_url":"https://api.github.com/repos/Roblox/rodux/deployments","created_at":"2017-10-11T18:37:04Z","updated_at":"2018-03-07T22:08:59Z","pushed_at":"2018-03-09T00:08:02Z","git_url":"git://github.com/Roblox/rodux.git","ssh_url":"git@github.com:Roblox/rodux.git","clone_url":"https://github.com/Roblox/rodux.git","svn_url":"https://github.com/Roblox/rodux","homepage":"","size":39,"stargazers_count":10,"watchers_count":10,"language":"Lua","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":2,"open_issues":5,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Roblox/rodux/pulls/17"},"html":{"href":"https://github.com/Roblox/rodux/pull/17"},"issue":{"href":"https://api.github.com/repos/Roblox/rodux/issues/17"},"comments":{"href":"https://api.github.com/repos/Roblox/rodux/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/Roblox/rodux/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/Roblox/rodux/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Roblox/rodux/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/Roblox/rodux/statuses/43bb2ce40e74573191bd9087d3291f0cff7e5dd6"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"LPGhatguy"}}