{"action":"created","issue":{"url":"https://api.github.com/repos/mobxjs/mobx-react/issues/77","repository_url":"https://api.github.com/repos/mobxjs/mobx-react","labels_url":"https://api.github.com/repos/mobxjs/mobx-react/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/mobxjs/mobx-react/issues/77/comments","events_url":"https://api.github.com/repos/mobxjs/mobx-react/issues/77/events","html_url":"https://github.com/mobxjs/mobx-react/issues/77","id":164067850,"number":77,"title":"@observer(['store props']) not available to react-dnd","user":{"login":"jamiewinder","id":4442179,"avatar_url":"https://avatars.githubusercontent.com/u/4442179?v=3","gravatar_id":"","url":"https://api.github.com/users/jamiewinder","html_url":"https://github.com/jamiewinder","followers_url":"https://api.github.com/users/jamiewinder/followers","following_url":"https://api.github.com/users/jamiewinder/following{/other_user}","gists_url":"https://api.github.com/users/jamiewinder/gists{/gist_id}","starred_url":"https://api.github.com/users/jamiewinder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamiewinder/subscriptions","organizations_url":"https://api.github.com/users/jamiewinder/orgs","repos_url":"https://api.github.com/users/jamiewinder/repos","events_url":"https://api.github.com/users/jamiewinder/events{/privacy}","received_events_url":"https://api.github.com/users/jamiewinder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-07-06T12:49:54Z","updated_at":"2016-07-06T17:10:56Z","closed_at":null,"body":"I had posted this as a comment in #64 , but I think it may be an issue in its own right rather than a question of usage.\r\n\r\nWhen using `@observer([stores])` with react-dnd, the injected props aren't available to the react-dnd functions.\r\n\r\n```typescript\r\n\r\nconst dragSourceSpec = {\r\n    beginDrag(props) {\r\n        const appState = props.appState; // appState is undefined\r\n        // ...\r\n    }\r\n};\r\n\r\nconst dragSourceCollect = (...);\r\n\r\n@DragSource('item', dragSourceSpec, dragSourceCollect)\r\n@observer(['appState'])class MyItem extends Component {\r\n     // ...\r\n}\r\n```\r\nSwapping the decorators around fixes this, but causes `@observer` to have no effect other than the props injection.\r\n\r\nLet me know if any more details are needed."},"comment":{"url":"https://api.github.com/repos/mobxjs/mobx-react/issues/comments/230840048","html_url":"https://github.com/mobxjs/mobx-react/issues/77#issuecomment-230840048","issue_url":"https://api.github.com/repos/mobxjs/mobx-react/issues/77","id":230840048,"user":{"login":"jtraub","id":153191,"avatar_url":"https://avatars.githubusercontent.com/u/153191?v=3","gravatar_id":"","url":"https://api.github.com/users/jtraub","html_url":"https://github.com/jtraub","followers_url":"https://api.github.com/users/jtraub/followers","following_url":"https://api.github.com/users/jtraub/following{/other_user}","gists_url":"https://api.github.com/users/jtraub/gists{/gist_id}","starred_url":"https://api.github.com/users/jtraub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtraub/subscriptions","organizations_url":"https://api.github.com/users/jtraub/orgs","repos_url":"https://api.github.com/users/jtraub/repos","events_url":"https://api.github.com/users/jtraub/events{/privacy}","received_events_url":"https://api.github.com/users/jtraub/received_events","type":"User","site_admin":false},"created_at":"2016-07-06T17:10:56Z","updated_at":"2016-07-06T17:10:56Z","body":"It is expected HOC behavior and it is documented in `README.md`\r\n\r\n> observer will pick up the named stores from the context and make them available as props of the decorated component\r\n\r\nIn your case _decorated component_ is `class TestComponent ..`. `observer` provides `appStore` to this component.\r\n\r\nI would recommend you to install React Developer Tools and see an actual component hierarchy in your example to better understand how several decorators are applied to a component."}}
{"actor":{"display_login":"jtraub"}}