Erik, thanks so much. I now understand everything. What had confused me was the example in the Navigation library. Because that uses hash-routing , it can work with anchors and not need to create Messages and use preventdefault. I had inferred too much form that about how to work with ordinary links. It tuend out then that I only needed to make modest changes to my App to make routing helpful, rather than a massive source of extra, unused messages!
Simon On Sunday, 27 November 2016 02:00:08 UTC+1, Erik Lott wrote: > > that should say : > Simon, I'm just glancing at this code, but this page *shouldn't* perform > page refreshes at all. It should only fire UrlChange events without reload > the browser. Am I missing something? > > On Saturday, November 26, 2016 at 5:59:56 PM UTC-5, Erik Lott wrote: >> >> The aim is to get the navigation history ticking along properly without >>> page refreshes. >> >> >> Simon, I'm just glancing at this code, but this page should perform page >> refreshes at all. It should only fire UrlChange events without reload the >> browser. Am I missing something? >> >> On Saturday, November 26, 2016 at 10:54:53 AM UTC-5, Simon wrote: >>> >>> Here is some code to make things more concrete >>> https://gist.github.com/simonh1000/9368f9dbd7f93646207ec27fdf3662a2 >>> >>> It is based on the example from the Navigation library, but with the >>> links changed from # to (I think they are called) HTML5 links. >>> >>> I added an onClick handler to provide a preventDefault as otherwise the >>> links 404, but with this handler the links don’t navigate instead >>> >>> The aim is to get the navigation history ticking along properly without >>> page refreshes. >>> >>> I know its possible as I’ve seen it in other routers >>> >>> Simon >>> >>> On Saturday, 26 November 2016 13:44:20 UTC+1, Wouter In t Velt wrote: >>> >>> Thank you for the explanation Erik! With the upgrade to 0.18 and the >>>> changes in navigation, I was wondering which route (pun intended) to >>>> follow >>>> with the upgrade. Not sure I follow completely though. >>>> >>>> In option 1, could you deal with redirect-like scenario's inside the >>>> SPA? >>>> Like >>>> >>>> 1. user is on the "/apples" page, showing all available apples. >>>> 2. user types "/apples/234" in the url-bar >>>> 3. there happens to be no such apple >>>> 4. I want the user to stay on the "/apples" page, and get a message >>>> like "this apple is forbidden fruit" >>>> 5. at this point, I would want the url-bar to also say "/apples" >>>> >>>> Can this work with option 1? Or is this only possible with option 2? >>>> >>> >>> >> -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
