{"action":"created","issue":{"url":"https://api.github.com/repos/elm-lang/core/issues/682","repository_url":"https://api.github.com/repos/elm-lang/core","labels_url":"https://api.github.com/repos/elm-lang/core/issues/682/labels{/name}","comments_url":"https://api.github.com/repos/elm-lang/core/issues/682/comments","events_url":"https://api.github.com/repos/elm-lang/core/issues/682/events","html_url":"https://github.com/elm-lang/core/issues/682","id":169962343,"number":682,"title":"State filtering idea","user":{"login":"OvermindDL1","id":401605,"avatar_url":"https://avatars.githubusercontent.com/u/401605?v=3","gravatar_id":"","url":"https://api.github.com/users/OvermindDL1","html_url":"https://github.com/OvermindDL1","followers_url":"https://api.github.com/users/OvermindDL1/followers","following_url":"https://api.github.com/users/OvermindDL1/following{/other_user}","gists_url":"https://api.github.com/users/OvermindDL1/gists{/gist_id}","starred_url":"https://api.github.com/users/OvermindDL1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OvermindDL1/subscriptions","organizations_url":"https://api.github.com/users/OvermindDL1/orgs","repos_url":"https://api.github.com/users/OvermindDL1/repos","events_url":"https://api.github.com/users/OvermindDL1/events{/privacy}","received_events_url":"https://api.github.com/users/OvermindDL1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-08T16:11:46Z","updated_at":"2016-08-08T16:11:47Z","closed_at":null,"body":"I do say that I wish there were some way to make some 'update' call as no-view and/or no-subscription re-call needed.  Like instead of returning `( model, Cmd.none )` we could do `( model, Cmd.cancelView )` or `( model, Cmd.cancelSubscription )` or both via `Cmd.batch`, or perhaps as a three-argument tuple that defaults to `( model, Cmd.none, StateChanges.none )` or so, which would default to calling everything.  I have a lot of update messages that are handled that do not change the view and/or subscriptions and it would be nice to prevent calling those somehow.  Hmm, actually a backward compatible change would be to add a new Program callback, in addition to the usual `init`, `update`, `subscriptions`, and `view`, add another one that I will call just `blah` for now, optional in the Program or so, but have it be like:\r\n```\r\nblah : Msg -> ( Msg, States )\r\nblah msg ->\r\n  case msg of\r\n    MyMessageThree _ -> ( msg, States.batch [ States.cancelView, States.cancelSubscriptions )\r\n    MyMessageNine arg0 _ -> ( MyMessageThree arg0, States.noChanges ) -- or `States.none`?\r\n    MyRedrawMessage -> ( msg, States.cancelView )\r\n    MyMessageTwelve _ -> ( msg, States.onlyUpdate )\r\n    _ -> ( msg, States.noChanges )\r\n```\r\n\r\nAnd it would be called after `init` and before every call of `update`.  It would allow an easy way to translate one message type into another (maybe even a way to decorate it more so it can get passed to another modules update/subscription, this would be a **great** hooking location for modules), as well as a way to specify what states should be updated for a given message, a default no-op function could be supplied via `States.defaultHandle` or so that you could pass to the program so people do not have to override it in the easy cases.\r\n\r\nHmm, an idea for a module handler, one of the states could be something like:\r\n```elm\r\n    MaterialMessage msg -> ( msg, States.delegate { update=Material.update, subscriptions=Material.subscriptions } )\r\n```\r\nWhich of course the other module could simplify via a helper to:\r\n```elm\r\n    MaterialMessage msg -> Material.blah msg\r\n```\r\n\r\nLooking at https://github.com/elm-lang/core/blob/4.0.4/src/Native/Platform.js shows that it would be easy to add that functionality to core.\r\n\r\nSo ideas about this style, issues, etc...?"},"comment":{"url":"https://api.github.com/repos/elm-lang/core/issues/comments/238287052","html_url":"https://github.com/elm-lang/core/issues/682#issuecomment-238287052","issue_url":"https://api.github.com/repos/elm-lang/core/issues/682","id":238287052,"user":{"login":"process-bot","id":16453249,"avatar_url":"https://avatars.githubusercontent.com/u/16453249?v=3","gravatar_id":"","url":"https://api.github.com/users/process-bot","html_url":"https://github.com/process-bot","followers_url":"https://api.github.com/users/process-bot/followers","following_url":"https://api.github.com/users/process-bot/following{/other_user}","gists_url":"https://api.github.com/users/process-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/process-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/process-bot/subscriptions","organizations_url":"https://api.github.com/users/process-bot/orgs","repos_url":"https://api.github.com/users/process-bot/repos","events_url":"https://api.github.com/users/process-bot/events{/privacy}","received_events_url":"https://api.github.com/users/process-bot/received_events","type":"User","site_admin":false},"created_at":"2016-08-08T16:11:47Z","updated_at":"2016-08-08T16:11:47Z","body":"Thanks for the issue! Make sure it satisfies [this checklist][checklist]. My human colleagues will appreciate it!\n\nHere is [what to expect next][expectations], and if anyone wants to comment, keep [these things][participation] in mind.\n\n[checklist]: https://github.com/process-bot/contribution-checklist/blob/master/issues.md\n[expectations]: https://github.com/process-bot/contribution-checklist/blob/master/expectations.md\n[participation]: https://github.com/process-bot/contribution-checklist/blob/master/participation.md"}}
{"actor":{"display_login":"process-bot"}}