Regarding the view function being called twice, it seems inevitable as it's 
called on the click event and then on the urlUpdate. The example in the 
Navigation repo works like in your code and is also called twice. I don't 
think this has any practical implication as nothing is rendered twice. 
Although it seems odd.

On Saturday, 3 September 2016 08:19:59 UTC-3, Peter wrote:
>
> Hello all,
>
> I spent the past week inbetween projects so took the time to have a good 
> look at Elm and its starting to look good apart from when I blink or have a 
> coffee break and then it seems to have all fallen out of my head.
> Maybe its age as my knees have gone as well...
>
> As a bit of history, web work accounts for about 1/3 of our current 
> business and over the years this has gone from:
>
>
>    - *asp.net <http://asp.net>* - project went live in 2002 or so 
>    (initial development was on the beta versions and tweaked slightly as the 
>    official release came out and then modified again during the years)
>       - This is still running but luckily I've not had to touch it for 
>       years as it was doing some fancy things (at the time) with image 
> processing
>       - Chosen as at the time we did 80% windows desktop work so c# 
>       skills in hand anyway
>       - Looking back it was clunky and evil and that may still be the 
>       case as I've not looked at any of the newer versions and now we only do 
> 10% 
>       windows based work
>    - *Django* - reworked a couple of internal projects to this
>       - Was ok for what we wanted although didnt use it for any paying 
>       customer work
>    - *Rails* - couple of internal projects and some proof of concept work 
>    for customers
>       - Not for me at the time
>    - *Python/Tornado* - A lot of our back end json API work is  written 
>    in this and was an easy step to using templates to return pages to the 
> users
>       - Python, whats not to like!
>       - Quite a few projects written in this and quite a bit of in house 
>       Python skills
>    - *Angular 1* - In a bid to make a few of our apps more snappy
>       - Quite enjoyed this and have a few large scale projects with heavy 
>       back end db work and front end users interacting with maps
>    - *React/Riot/Vue* - Looking for something a little more lightweight 
>    and less "frameworky"
>       - Have a few projects using Riot and quite happy with those
>    - *Elm* - Ive not touched Lazy ML or Haskell wince way back when at 
>    Uni and that still brings me out in a cold sweat.
>
>
> Now I seem to have got on reasonably well over a few days and must have 
> read just about everything I could get my hands on.
> Written small test apps for json parsing and general language 
> functionality which has gone OK but then I read too much and get myself in 
> a pickle, especially in working out how to handle routing/navigation.
>
> Seems I get really close and it all makes sense then it goes again :(
>
> I've put together a simple "all code in one file" demo app here 
> <https://gist.github.com/anonymous/438426ba352cea84fe57d2a68cc28cca>
>
> Its a simple app that has a main index screen with the option to show 2 
> others - a list of people and then a specific person. Run of the mill stuff.
> This was cobbled together from all the navigation/routing sample apps I 
> found.
>
> Theres a lot of debug lines in there to show what is being called and when.
>
> I'm at a bit of a loss as to where to put the "doing" bit, for example:
>
> From the index screen the user would click on Show People and this message 
> is processed in the updateMain function.
> Here is where I should be getting the list of people (from a json call, or 
> just returning a list to keep the demo simple) and storing this in the 
> models People property?
>
> Theres some navigation calls here to update the visible url and also set 
> the current route in the model (Navigation.newUrl url)
>
> This seems to call the view code twice when looking at the console logs?
>
> Also, if the user enters a url from scratch (say, localhost:8000/#/users) 
> then this would need to know to get the list of users.
> I'm handling this via the init function to get the initial route entered 
> and then set the state for that route but that looks like duplication of 
> what the ShowPeople message would be doing.
>
>
> Am I putting things in the wrong place here and going about things the 
> wrong way?
>
> Maybe it will all just click soon as I've got myself all tied up from 
> reading too much.
> Theres been moments of clarity where its all clear and I start thinking in 
> the Elm way and its a great feeling!
>
> Demo code 
> <https://gist.github.com/anonymous/438426ba352cea84fe57d2a68cc28cca> - 
> this is run with a simple index.html file via *python -m SimpleHTTPServer 
> *in case of any issues with # url parsing via elm-reactor.
>
> Thanks, and as I've never said to the wife, apologies for length.
>

-- 
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.

Reply via email to