{"action":"opened","issue":{"url":"https://api.github.com/repos/Day8/re-frame/issues/516","repository_url":"https://api.github.com/repos/Day8/re-frame","labels_url":"https://api.github.com/repos/Day8/re-frame/issues/516/labels{/name}","comments_url":"https://api.github.com/repos/Day8/re-frame/issues/516/comments","events_url":"https://api.github.com/repos/Day8/re-frame/issues/516/events","html_url":"https://github.com/Day8/re-frame/issues/516","id":383605053,"node_id":"MDU6SXNzdWUzODM2MDUwNTM=","number":516,"title":"reg-sub, syntax sugar and single values","user":{"login":"urzds","id":15085501,"node_id":"MDQ6VXNlcjE1MDg1NTAx","avatar_url":"https://avatars2.githubusercontent.com/u/15085501?v=4","gravatar_id":"","url":"https://api.github.com/users/urzds","html_url":"https://github.com/urzds","followers_url":"https://api.github.com/users/urzds/followers","following_url":"https://api.github.com/users/urzds/following{/other_user}","gists_url":"https://api.github.com/users/urzds/gists{/gist_id}","starred_url":"https://api.github.com/users/urzds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urzds/subscriptions","organizations_url":"https://api.github.com/users/urzds/orgs","repos_url":"https://api.github.com/users/urzds/repos","events_url":"https://api.github.com/users/urzds/events{/privacy}","received_events_url":"https://api.github.com/users/urzds/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-22T16:37:39Z","updated_at":"2018-11-22T16:37:39Z","closed_at":null,"author_association":"NONE","body":"The [documentation for reg-sub](https://cljdoc.org/d/re-frame/re-frame/0.10.6/api/re-frame.subs#reg-sub) gives an example as follows for the \"syntax sugar\" case:\r\n```clj\r\n(reg-sub\r\n  ::example\r\n  :<- [::a]\r\n  :<- [::b]\r\n  (fn [[a b] _query]\r\n    {:a a :b b}))\r\n```\r\n\r\nAs a re-frame user, I would think I could quickly adapt it to my case like this:\r\n```clj\r\n(reg-sub\r\n  ::example\r\n  :<- [::single]\r\n  (fn [[single] _query]\r\n    {:s single}))\r\n```\r\n\r\nThis will blow up with very hard to understand and debug error messages like `Error rendering component` and `Error: nth not supported on this type function <gibberish>`.\r\n\r\nTo improve usability without breaking backwards compatibility (the easy fix would be to always pass a vector, even in case there is only one `:<-`), I would suggest to test whether the user-supplied function expects a vector in the first argument or not and pass it the input signal accordingly."}}
{"actor":{"display_login":"urzds"}}