{"action":"created","issue":{"url":"https://api.github.com/repos/rematch/rematch/issues/450","repository_url":"https://api.github.com/repos/rematch/rematch","labels_url":"https://api.github.com/repos/rematch/rematch/issues/450/labels{/name}","comments_url":"https://api.github.com/repos/rematch/rematch/issues/450/comments","events_url":"https://api.github.com/repos/rematch/rematch/issues/450/events","html_url":"https://github.com/rematch/rematch/pull/450","id":335133953,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2OTIyMzQw","number":450,"title":"Add `reduxReducer` config to `Model`","user":{"login":"d3dc","id":4175887,"node_id":"MDQ6VXNlcjQxNzU4ODc=","avatar_url":"https://avatars0.githubusercontent.com/u/4175887?v=4","gravatar_id":"","url":"https://api.github.com/users/d3dc","html_url":"https://github.com/d3dc","followers_url":"https://api.github.com/users/d3dc/followers","following_url":"https://api.github.com/users/d3dc/following{/other_user}","gists_url":"https://api.github.com/users/d3dc/gists{/gist_id}","starred_url":"https://api.github.com/users/d3dc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/d3dc/subscriptions","organizations_url":"https://api.github.com/users/d3dc/orgs","repos_url":"https://api.github.com/users/d3dc/repos","events_url":"https://api.github.com/users/d3dc/events{/privacy}","received_events_url":"https://api.github.com/users/d3dc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-06-23T21:59:06Z","updated_at":"2018-06-24T18:04:14Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/rematch/rematch/pulls/450","html_url":"https://github.com/rematch/rematch/pull/450","diff_url":"https://github.com/rematch/rematch/pull/450.diff","patch_url":"https://github.com/rematch/rematch/pull/450.patch"},"body":"Writing #447, I wanted to use a model to expose the effects and selectors of an existing library instead of modifying the store.\r\n\r\nTo provide a library reducer, we have to put it in `redux.reducers` - which will get replaced by a model of the same name. Writing a model claims that reducer name.\r\n\r\nI also wrote a little plugin for #414, which just lifted the redux actions to the rematch format, _as if they came from a model_. Writing a model implicitly lifts the libraries actions to be listened for.\r\n\r\n```js\r\n{\r\n  middleware: navMiddleware,\r\n  config: {\r\n    models: {\r\n      [storeKey]: {\r\n        reduxReducer: navReducer,\r\n        effects,\r\n        selectors\r\n      },\r\n    },\r\n  },\r\n}\r\n```\r\n\r\nThe only downside is that the library actions then have to be `effects`, which are async."},"comment":{"url":"https://api.github.com/repos/rematch/rematch/issues/comments/399775384","html_url":"https://github.com/rematch/rematch/pull/450#issuecomment-399775384","issue_url":"https://api.github.com/repos/rematch/rematch/issues/450","id":399775384,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTc3NTM4NA==","user":{"login":"ShMcK","id":4660659,"node_id":"MDQ6VXNlcjQ2NjA2NTk=","avatar_url":"https://avatars0.githubusercontent.com/u/4660659?v=4","gravatar_id":"","url":"https://api.github.com/users/ShMcK","html_url":"https://github.com/ShMcK","followers_url":"https://api.github.com/users/ShMcK/followers","following_url":"https://api.github.com/users/ShMcK/following{/other_user}","gists_url":"https://api.github.com/users/ShMcK/gists{/gist_id}","starred_url":"https://api.github.com/users/ShMcK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ShMcK/subscriptions","organizations_url":"https://api.github.com/users/ShMcK/orgs","repos_url":"https://api.github.com/users/ShMcK/repos","events_url":"https://api.github.com/users/ShMcK/events{/privacy}","received_events_url":"https://api.github.com/users/ShMcK/received_events","type":"User","site_admin":false},"created_at":"2018-06-24T18:04:14Z","updated_at":"2018-06-24T18:04:14Z","author_association":"MEMBER","body":"Ah, so you imagine a `model.reduxReducer` and `model.reducers` could be used together?\r\n\r\nI'd love to see an example of how it would work."}}
{"actor":{"display_login":"ShMcK"}}