-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to handle hash in Routing.Match #60
Comments
Hi, thanks for your question. I would recommend https://discourse.purescript.org/ as a better outlet for Q&A type stuff. It will get more visibility, and is more likely to get an answer than an issue tracker, which is generally for bugs/requests. |
Otherwise, it's hard to say without knowing what |
Thanks for response. I made a reproduction https://github.com/rnons/purescript-routing-issue-60 |
Unfortunately, the internal parser representation makes no consideration for hashes. https://github.com/slamdata/purescript-routing/blob/c11efec0f5f992f86c907de791826271e43ebd5d/src/Routing/Types.purs#L8 I think this is because the library was originally for hash-based routing only, which does not usually cater to hashes within a hash. The parser splits on |
For now, I would do what you are doing, which is stripping the hash. I've been working on an alternative parser/printer library which should be able to interface with |
I have a route like this
When using
Routing.PushState.matches
,/region/west
will match, but/region/west#hash
will fail. I understand myregionMatcher
failed to parsewest#hash
asRegion
.I ended up dropping the hash before hand.
myMatch = matchesWith <<< matchWith (unsafeDecodeURIComponent <<< String.takeWhile (_ /= String.codePointFromChar '#'))
Wondering is there a better way to handle this?
The text was updated successfully, but these errors were encountered: