{"action":"closed","issue":{"url":"https://api.github.com/repos/lhorie/mithril.js/issues/510","labels_url":"https://api.github.com/repos/lhorie/mithril.js/issues/510/labels{/name}","comments_url":"https://api.github.com/repos/lhorie/mithril.js/issues/510/comments","events_url":"https://api.github.com/repos/lhorie/mithril.js/issues/510/events","html_url":"https://github.com/lhorie/mithril.js/issues/510","id":63629720,"number":510,"title":"components: Problems with nesting components","user":{"login":"sloria","id":2379650,"avatar_url":"https://avatars.githubusercontent.com/u/2379650?v=3","gravatar_id":"","url":"https://api.github.com/users/sloria","html_url":"https://github.com/sloria","followers_url":"https://api.github.com/users/sloria/followers","following_url":"https://api.github.com/users/sloria/following{/other_user}","gists_url":"https://api.github.com/users/sloria/gists{/gist_id}","starred_url":"https://api.github.com/users/sloria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sloria/subscriptions","organizations_url":"https://api.github.com/users/sloria/orgs","repos_url":"https://api.github.com/users/sloria/repos","events_url":"https://api.github.com/users/sloria/events{/privacy}","received_events_url":"https://api.github.com/users/sloria/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-23T05:34:21Z","updated_at":"2015-03-25T00:29:58Z","closed_at":"2015-03-25T00:29:58Z","body":"I've been trying out the new \"modules-as-components\" API on the `components` branch and ran into a snag: one cannot nest components past a depth of one. This is due to the constraint that components *must* return a virtual element--returning a module is not allowed.\r\n\r\nExample breaking code:\r\n\r\n```js\r\nvar Panel = {\r\n    view: function(ctrl, args, children) {\r\n        return m('.mypanel', [\r\n            m('.mypanel-header', [args.header], children)\r\n        ]);\r\n    }\r\n};\r\n\r\nvar Menu = {\r\n    view: function(ctrl, args) {\r\n        return m.module(Panel, {header: 'My Menu'});\r\n    }\r\n};\r\n\r\nvar Page = {\r\n    view: function(ctrl, args) {\r\n        // Crashes because Menu.view returns a module\r\n        return [\r\n            m.module(Menu, {})\r\n        ];\r\n    }\r\n}\r\n```"}}