elm-mdl
elm-mdl copied to clipboard
Docs & demo for Layout, Menu should emphasize subscriptions
People regularly report bugs on the elm-slack that resizing breaks Layout in various ways, or menus don't click to close because they have not set up subscriptions.
Demo should include subscription set up and a big notice at the top; docs should have a similar notice.
Excepting my ProgramEx that can register everything at once without issue or forgetting possible things like subscription, can you think of a way to throw some kind of error if the elm-mdl subscription is not added in?
That'd be by far the best, of course. However, I can't think of a way to detect whether subscriptions were set-up or not?
I was trying to figure out the same thing, the lack of metaprogramming/macros in Elm is exceedingly limiting... Although HKT's are far more important, it really needs those.
Note: also init
.
Here's what need to be done:
- [ ] Add setup code sample to Layout Demo (subscriptions, init, maybe tab sizing)
- [ ] Add text prominently in the Layout Demo indicating need for subscriptions, init
- [ ] Add setup code sample to Menu Demo (subscriptions)
- [ ] Add text prominently in the Menu demo
Mind if I tackle this @debois? Just ran into the problem myself, but figured it out by digging through: https://github.com/debois/elm-mdl/blob/v8/demo/Demo.elm
I ran into an issue recently and has taken me a few hours to figure out. My fixedDraw was open by default on small screens and not rendering correctly.
Eventually found the issue thanks to @dubert's comment. Particularly I wasn't using the Material init function as in https://github.com/debois/elm-mdl/blob/60736e03ad44bb0f28fe6e8ad7c8b22203d29fe8/demo/Demo.elm#L487
I had the layout subscription, and updated that to the Material subscription. Leaving this comment here in case it helps someone else.
Definitely in support of the docs having way more detail about setting things up correctly - right now it's hard to figure out where problems actually are.