The guide says pushstate routing is out of scope...
Closed this issue ยท 9 comments
This library facilitates hash-based routing. If you're looking to do pushstate routing with the history object, then you are in the wrong place.
Do you know of a "good place" for this?
I don't see why we couldn't accomodate pushState routing, it's just not supported at the moment.
Question: would it be a good move to split this in two repositories which could roughly be called
- purescript-route-parser
- purescript-hash-navigation?
The two concerns of handling SPA navigation and route parsing would be separate which enables people to mix and match their preferred approach.
At least, I suppose that could be simpler than having one routing package that supports both hash based navigation and pushstate based navigation.
Yeah I think something like that would make sense. We could just have purescript-routing as the data structure/parser and then purescript-routing-hash / purescript-routing-pushstate perhaps, rather than abandoning the current naming.
Hi, i am trying to write pushstate api and using purescript-routing as the parser. Then i found this: https://pursuit.purescript.org/packages/purescript-dom/4.5.0/docs/DOM.HTML.History#v:DocumentTitle
but then I check this repo, i don't see any use of purescript-dom besides DOM() and in here
https://github.com/slamdata/purescript-routing/blob/master/src/Routing.js#L3
you create your own hashChanged, instead of using the existing:
https://pursuit.purescript.org/packages/purescript-dom/4.5.0/docs/DOM.HTML.Event.HashChangeEvent
Is there any reason to that? I mean I just want to use purescript-routing with pushState api but I still figure it out where to start.
The chances are that stuff didn't exist in purescript-dom when this library was created, exterminating unnecessary FFI code is always a ๐ from me ๐
I'm relying on pushState routing with this repository and Halogen in my own application. I've put together a tiny working example repository here to demonstrate:
https://github.com/saylu/halogen-pushstate
My version relies on co-routines and performing those state updates within navigation events in Halogen, so it's intertwined with your actual application. I haven't used the hash routing from this library yet, so I'm not sure how different my implementation is.
Regardless: if what I have done is reasonably close to how push state could be implemented with this library, then I'm happy to continue working on it to add that functionality and submit a PR.
just dropping some extra notes on this... i've just done a fair amount of work to integrate pushState routing into a halogen app w/ the guidance of many of the folks on this thread. in the longer term, i think the most ergonomic solution would be to wrap pushState (in JS) and expose it via FFI so that it can emit callbacks similar to onhashchange. happy to take this on when i've got more bandwidth, as i'm pretty familiar w/ the tools at hand now!
Any updates on this? :)
I'm also interested in pushState routing..