{"action":"created","issue":{"url":"https://api.github.com/repos/grych/drab/issues/116","repository_url":"https://api.github.com/repos/grych/drab","labels_url":"https://api.github.com/repos/grych/drab/issues/116/labels{/name}","comments_url":"https://api.github.com/repos/grych/drab/issues/116/comments","events_url":"https://api.github.com/repos/grych/drab/issues/116/events","html_url":"https://github.com/grych/drab/issues/116","id":321095257,"number":116,"title":"Conditionals and v.077","user":{"login":"guidotripaldi","id":12702951,"avatar_url":"https://avatars2.githubusercontent.com/u/12702951?v=4","gravatar_id":"","url":"https://api.github.com/users/guidotripaldi","html_url":"https://github.com/guidotripaldi","followers_url":"https://api.github.com/users/guidotripaldi/followers","following_url":"https://api.github.com/users/guidotripaldi/following{/other_user}","gists_url":"https://api.github.com/users/guidotripaldi/gists{/gist_id}","starred_url":"https://api.github.com/users/guidotripaldi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidotripaldi/subscriptions","organizations_url":"https://api.github.com/users/guidotripaldi/orgs","repos_url":"https://api.github.com/users/guidotripaldi/repos","events_url":"https://api.github.com/users/guidotripaldi/events{/privacy}","received_events_url":"https://api.github.com/users/guidotripaldi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-05-08T08:44:54Z","updated_at":"2018-05-08T13:31:15Z","closed_at":null,"author_association":"NONE","body":"It seems that in v. 0.77 Drab changed the way it handles conditionals. If an assign is poked when it is used inside a conditional, Drab rises an error when the state of the condition disables the use of the assign, though if the same assignment is used elsewhere in the same code.\r\n\r\nIn Drab 0.76 this sample code works as expected:\r\n\r\n```elixir\r\n# MyController\r\n...\r\n  render(conn, \"index.html\", my_list: [])\r\n...\r\n```\r\n\r\n```elixir\r\n# MyCommander\r\n\r\ndefhandler do_update(socket) do\r\n...\r\n   poke(socket, \"index.html\", my_list: [\"A\", \"B\", \"C\"])\r\nend\r\n```\r\n\r\n```eex\r\n<!-- index.html.drab -->\r\n\r\n<p> `my_list` is: <%= inspect @my_list %> </p>\r\n\r\n<%= if @my_list == [] do %>\r\n\t<p> `my_list` is empty</p>\r\n<%= else %>\r\n\t<p> <%= inspect @my_list %> </p>\r\n<% end %>\r\n```\r\n\r\nbut in Drab 0.77, when the above `if` is `true` (i.e. the `@my_list` in `else` isn't displayed), it rises this error :\r\n\r\n```\r\n10:22:05.215 [error] Drab Handler failed with the following exception:\r\n** (MatchError) no match of right hand side value: nil\r\n    (drab) lib/drab/live.ex:504: anonymous fn/5 in Drab.Live.do_poke/5\r\n    (elixir) lib/enum.ex:1899: Enum.\"-reduce/3-lists^foldl/2-0-\"/3\r\n    (drab) lib/drab/live.ex:497: Drab.Live.do_poke/5\r\n    (frontend_web) lib/my_app_web/commanders/my_commander.ex:144: MyAppWeb.MyCommander.do_update/1\r\n    (drab) lib/drab.ex:228: anonymous fn/3 in Drab.handle_callback/3\r\n```"},"comment":{"url":"https://api.github.com/repos/grych/drab/issues/comments/387402822","html_url":"https://github.com/grych/drab/issues/116#issuecomment-387402822","issue_url":"https://api.github.com/repos/grych/drab/issues/116","id":387402822,"user":{"login":"guidotripaldi","id":12702951,"avatar_url":"https://avatars2.githubusercontent.com/u/12702951?v=4","gravatar_id":"","url":"https://api.github.com/users/guidotripaldi","html_url":"https://github.com/guidotripaldi","followers_url":"https://api.github.com/users/guidotripaldi/followers","following_url":"https://api.github.com/users/guidotripaldi/following{/other_user}","gists_url":"https://api.github.com/users/guidotripaldi/gists{/gist_id}","starred_url":"https://api.github.com/users/guidotripaldi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guidotripaldi/subscriptions","organizations_url":"https://api.github.com/users/guidotripaldi/orgs","repos_url":"https://api.github.com/users/guidotripaldi/repos","events_url":"https://api.github.com/users/guidotripaldi/events{/privacy}","received_events_url":"https://api.github.com/users/guidotripaldi/received_events","type":"User","site_admin":false},"created_at":"2018-05-08T13:31:15Z","updated_at":"2018-05-08T13:31:15Z","author_association":"NONE","body":"> Did you try mix clean?\r\nyes, first thing I've done.\r\n\r\nI'm trying to generalize the code where the error is announced to better understand the problem, I hope to share everything in a few minutes"}}
{"actor":{"display_login":"guidotripaldi"}}