{"action":"created","issue":{"url":"https://api.github.com/repos/hyperapp/hyperapp/issues/158","repository_url":"https://api.github.com/repos/hyperapp/hyperapp","labels_url":"https://api.github.com/repos/hyperapp/hyperapp/issues/158/labels{/name}","comments_url":"https://api.github.com/repos/hyperapp/hyperapp/issues/158/comments","events_url":"https://api.github.com/repos/hyperapp/hyperapp/issues/158/events","html_url":"https://github.com/hyperapp/hyperapp/issues/158","id":213609607,"number":158,"title":"Actions break when returning null","user":{"login":"dodekeract","id":1133858,"avatar_url":"https://avatars1.githubusercontent.com/u/1133858?v=3","gravatar_id":"","url":"https://api.github.com/users/dodekeract","html_url":"https://github.com/dodekeract","followers_url":"https://api.github.com/users/dodekeract/followers","following_url":"https://api.github.com/users/dodekeract/following{/other_user}","gists_url":"https://api.github.com/users/dodekeract/gists{/gist_id}","starred_url":"https://api.github.com/users/dodekeract/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dodekeract/subscriptions","organizations_url":"https://api.github.com/users/dodekeract/orgs","repos_url":"https://api.github.com/users/dodekeract/repos","events_url":"https://api.github.com/users/dodekeract/events{/privacy}","received_events_url":"https://api.github.com/users/dodekeract/received_events","type":"User","site_admin":false},"labels":[{"id":522275188,"url":"https://api.github.com/repos/hyperapp/hyperapp/labels/TALK","name":"TALK","color":"2BB048","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2017-03-12T14:55:00Z","updated_at":"2017-03-12T16:06:52Z","closed_at":null,"body":"In [app.js:77](https://github.com/hyperapp/hyperapp/blob/24fe0301f340d7e066ae25d14d416471f4c89c95/src/app.js#L77) hyperapp will crash if an action returns ~~a value that is neither `undefined` nor `typeof object` (also for `null`).~~ `null`.\r\n\r\nReason is that it tries to access `result.then` which is only possible for objects.\r\n\r\nAlso what should be the expected behavior if a function returns `null`? I used that in a previous version to get around `return` without any parameters. This lead me to discover this crash upon upgrading to `v0.7.1`.\r\n\r\nE.g.\r\n\r\n```javascript\r\n// abort if mode is `off`\r\nif (mode.toLowerCase() === 'off') return\r\nsomeFunctionCall()\r\n// without semicolons this looks like it would return the next line\r\n// similar to\r\nconst example = () =>\r\nsomeFunctionCall()\r\n// which would return the result of `someFunctionCall`\r\n// just because you're aware that `return` terminates on newline doesn't mean that it doesn't look like it wouldn't/shouldn't\r\n```\r\n\r\nFor now I'll use `undefined`, but it'd be good to have a defined behavior for `null` ~~and other primitives~~.\r\n\r\nMaybe we should introduce environment-specific errors like React does? They'd be amazing for development and can just get stripped away in production environments. There could be an error or warning in the case of `null` etc."},"comment":{"url":"https://api.github.com/repos/hyperapp/hyperapp/issues/comments/285954576","html_url":"https://github.com/hyperapp/hyperapp/issues/158#issuecomment-285954576","issue_url":"https://api.github.com/repos/hyperapp/hyperapp/issues/158","id":285954576,"user":{"login":"dodekeract","id":1133858,"avatar_url":"https://avatars1.githubusercontent.com/u/1133858?v=3","gravatar_id":"","url":"https://api.github.com/users/dodekeract","html_url":"https://github.com/dodekeract","followers_url":"https://api.github.com/users/dodekeract/followers","following_url":"https://api.github.com/users/dodekeract/following{/other_user}","gists_url":"https://api.github.com/users/dodekeract/gists{/gist_id}","starred_url":"https://api.github.com/users/dodekeract/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dodekeract/subscriptions","organizations_url":"https://api.github.com/users/dodekeract/orgs","repos_url":"https://api.github.com/users/dodekeract/repos","events_url":"https://api.github.com/users/dodekeract/events{/privacy}","received_events_url":"https://api.github.com/users/dodekeract/received_events","type":"User","site_admin":false},"created_at":"2017-03-12T16:06:52Z","updated_at":"2017-03-12T16:06:52Z","body":"@leeoniya Why is `== null` better than `== undefined`?"}}
{"actor":{"display_login":"dodekeract"}}