Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-16 Thread Nicolas Artman
I think you just need the equivalent of a custom component (like react-router's ) or attribute (like angular UI-router's ui-sref) that uses html5 pushState for all the routing. That is the modern, standards-compliant way to do SPA routing. I would strongly caution anyone against using hash

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-16 Thread Bob Hutchison
Hi, > > Navigate to http://localhost:8080/#test?a=b=d > What happens if you write it according to (https://tools.ietf.org/html/rfc3986#section-4.1): http://localhost:8080/?a=b=d#test > -- > You received this message because you are subscribed to the Google Groups > "Elm Discuss" group. >

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-11 Thread Nick H
Maybe Bogdanp/elm-querystring could be helpful? On Sun, Dec 11, 2016 at 2:23 PM, Charlie Koster wrote: > I don't disagree with anything your wrote there, but I still have this > problem to deal with now. The path of least resistance happens to also be > the path that uses

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-11 Thread Charlie Koster
I don't disagree with anything your wrote there, but I still have this problem to deal with now. The path of least resistance happens to also be the path that uses query strings that are technically correct (nevermind about technically correct URLs). If a library comes along and makes parsing

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-11 Thread Witold Szczerba
There is nothing "technically" incorrect in e.g. 15 All the SPA I have seen had URLs like this, because this is just the browser who cares about that part of the location. This is why, when creating e.g.: next there is no need to hack browser to stop it from page reload as this is all about

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-11 Thread Charlie Koster
If I use hashes I now have to do manual work in order to use and parse query strings. Let's say I want to handle a query string such as "myPage?search=things=asc". If there's a hash in front of "myPage" the query string doesn't get interpreted as a search string by elm-lang/Navigation

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-11 Thread Witold Szczerba
Why is it so important that your links does not start with a `#` aka fragment part? Regards, Witold Szczerba On Sun, Dec 11, 2016 at 4:51 PM, Charlie Koster wrote: > I think I came up with a workable solution by adding a tiny bit of > abstraction. > > import Html exposing

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-11 Thread Charlie Koster
I think I came up with a workable solution by adding a tiny bit of abstraction. import Html exposing (Attribute, Html, a) import Html.Events exposing (onWithOptions, defaultOptions) import Model exposing (Msg(..)) import Json.Decode as Json link : String -> List (Attribute Msg) -> List (Html

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-11 Thread Nicolas Artman
Yep, it's standard complaint as Nick said. This behavior also agrees with the routing behavior for most JS client stacks I've used as well. On Fri, Dec 9, 2016 at 6:06 PM Nick H wrote: > I would call this not a bug, since it conforms to the URL standard >

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-11 Thread Nicolas Artman
Standards *compliant. Sorry about the typo. On Sat, Dec 10, 2016 at 12:08 PM Nicolas Artman wrote: > Yep, it's standard complaint as Nick said. This behavior also agrees with > the routing behavior for most JS client stacks I've used as well. > On Fri, Dec 9, 2016 at 6:06 PM

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-11 Thread Charlie Koster
Thanks for the response, Magnus. If I'm understanding correctly, you have a parent div that prevents default click events of child elements, including your anchor tag, and turns them into `Attribute msg`. Your solution is interesting, although it looks like a fair amount of boilerplate and

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-11 Thread Magnus Rundberget
You could do something like this: https://github.com/rundis/albums/blob/master/frontend/src/Routes.elm#L84 Use it like this https://github.com/rundis/albums/blob/master/frontend/src/ArtistListing.elm#L100 And wire it up like this.

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-10 Thread Charlie Koster
Thanks for the responses. As a follow up, I want to start using parsePath instead of parseHash so that I can start using the query string. A problem I'm noticing is that if I have links in the app with the href attribute set to "/somePage" the page reloads which is undesirable with it being a

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-10 Thread Charlie Koster
Thanks for the responses. As a follow up, I want to start using parsePath instead of parseHash so that I can start using the query string. A problem I'm noticing is that if I have links in the app with the href attribute set to "/somePage" the page reloads which is undesirable with it being a

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-10 Thread Witold Szczerba
Nick is right. The two URLs: http://localhost:8080/test?a=b=d http://localhost:8080/#test?a=b=d have _nothing_ but the "origin" part in common. Note that everything after the `#` is just for the browser, the backend server will never get that. It won't tell the difference between:

Re: [elm-discuss] elm-lang/Navigation with hash and query string

2016-12-09 Thread Nick H
I would call this not a bug, since it conforms to the URL standard . in your second example, ?a=b=d is not a query string, but a part of the fragment string. This is just one of several ways that URL syntax can lead you down a dark alley and steal your

[elm-discuss] elm-lang/Navigation with hash and query string

2016-12-09 Thread Charlie Koster
I submitted an issue to evancz/url-parser but it ended up being human error on my part. However, I'm making this post because of my closing comment on that