{"action":"created","issue":{"url":"https://api.github.com/repos/yoshuawuyts/barracks/issues/53","repository_url":"https://api.github.com/repos/yoshuawuyts/barracks","labels_url":"https://api.github.com/repos/yoshuawuyts/barracks/issues/53/labels{/name}","comments_url":"https://api.github.com/repos/yoshuawuyts/barracks/issues/53/comments","events_url":"https://api.github.com/repos/yoshuawuyts/barracks/issues/53/events","html_url":"https://github.com/yoshuawuyts/barracks/issues/53","id":165086280,"number":53,"title":"Exception in reducer with namespace","user":{"login":"mantoni","id":332271,"avatar_url":"https://avatars.githubusercontent.com/u/332271?v=3","gravatar_id":"","url":"https://api.github.com/users/mantoni","html_url":"https://github.com/mantoni","followers_url":"https://api.github.com/users/mantoni/followers","following_url":"https://api.github.com/users/mantoni/following{/other_user}","gists_url":"https://api.github.com/users/mantoni/gists{/gist_id}","starred_url":"https://api.github.com/users/mantoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mantoni/subscriptions","organizations_url":"https://api.github.com/users/mantoni/orgs","repos_url":"https://api.github.com/users/mantoni/repos","events_url":"https://api.github.com/users/mantoni/events{/privacy}","received_events_url":"https://api.github.com/users/mantoni/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-12T13:54:28Z","updated_at":"2016-07-13T21:29:02Z","closed_at":null,"body":"The following code throws:\r\n\r\n```js\r\nconst barracks = require(\"barracks\");\r\n\r\nconst store = barracks();\r\nstore.model({\r\n  namespace: 'ns',\r\n  state: {},\r\n  reducers: {\r\n    a: () => {\r\n      return { a: 1 };\r\n    }\r\n  }\r\n});\r\n\r\nconst createSend = store.start();\r\nconst send = createSend('oups');\r\n\r\nstore.start();\r\nsend('ns:a', {}, () => {});\r\n```\r\n\r\nI get\r\n\r\n```\r\n.../barracks-test/node_modules/xtend/mutable.js:11\r\n                target[key] = source[key]\r\n                            ^\r\n\r\nTypeError: Cannot set property 'a' of undefined\r\n    at extend (.../barracks-test/node_modules/xtend/mutable.js:11:29)\r\n    at null._onTimeout (.../barracks-test/node_modules/barracks/index.js:164:13)\r\n    at Timer.listOnTimeout (timers.js:89:15)\r\n```\r\n\r\nWhen I don't use a namespace, this does not happen.\r\n\r\nApparently, namespaced modules are not initiallized by barracks. I can work around it like this:\r\n\r\n```js\r\nstore.model({\r\n  namespace: 'ns',\r\n  state: {\r\n    ns: {}\r\n  },\r\n  // ...\r\n});\r\n```\r\n\r\nThis makes sense when looking at the implementation, however it's not very intuitive."},"comment":{"url":"https://api.github.com/repos/yoshuawuyts/barracks/issues/comments/232492457","html_url":"https://github.com/yoshuawuyts/barracks/issues/53#issuecomment-232492457","issue_url":"https://api.github.com/repos/yoshuawuyts/barracks/issues/53","id":232492457,"user":{"login":"yoshuawuyts","id":2467194,"avatar_url":"https://avatars.githubusercontent.com/u/2467194?v=3","gravatar_id":"","url":"https://api.github.com/users/yoshuawuyts","html_url":"https://github.com/yoshuawuyts","followers_url":"https://api.github.com/users/yoshuawuyts/followers","following_url":"https://api.github.com/users/yoshuawuyts/following{/other_user}","gists_url":"https://api.github.com/users/yoshuawuyts/gists{/gist_id}","starred_url":"https://api.github.com/users/yoshuawuyts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yoshuawuyts/subscriptions","organizations_url":"https://api.github.com/users/yoshuawuyts/orgs","repos_url":"https://api.github.com/users/yoshuawuyts/repos","events_url":"https://api.github.com/users/yoshuawuyts/events{/privacy}","received_events_url":"https://api.github.com/users/yoshuawuyts/received_events","type":"User","site_admin":false},"created_at":"2016-07-13T21:29:02Z","updated_at":"2016-07-13T21:29:02Z","body":"Ack"}}
{"actor":{"display_login":"yoshuawuyts"}}