On Tue, Sep 5, 2017 at 10:02 AM, Vlad GURDIGA <gurd...@gmail.com> wrote:
> In my app I have a large data entry form where initial fields determine > which subsequent fields will be. It’s my understanding that every change to > the model should be its own message. So far I have 50 fields in total (and > there will probably be more) — does this mean that I need to have 50 things > in my Msg? Or am I seeing it wrong? 🤓 > > Yes, you need to handle all 50 things in your Msg but you don't need to have all 50 tags in the main Msg. You can handle things in chunks. Here is the Forms example altered to show one way to approach this: https://ellie-app.com/4dhSNYfnrqya1/0 Here is another way to structure that code: https://ellie-app.com/4dhSNYfnrqya1/1 And yet another way to structure it: https://ellie-app.com/4dhSNYfnrqya1/3 What might be appropriate to do in your case depends on the shape of the data. If the data can be split in smaller records that make sense maybe you should split it. If the data cannot be split and just needs to be one large record, then maybe you can split just the updates in some manner that makes sense to you and keep passing the same big record to all the update functions (second link from above) Needless to say that what you have above is only one section extracted. With multiple sections you will just have one root Msg for each section and update functions for each section. -- There is NO FATE, we are the creators. blog: http://damoc.ro/ -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.