Skip to content

Commit 343bf5a

Browse files
committed
Fix order of hash parsing
1 parent 94dd7e4 commit 343bf5a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Routing/Duplex/Parser.purs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,14 @@ runRouteParser = go
155155

156156
parsePath :: String -> RouteState
157157
parsePath =
158-
splitAt (flip Tuple "") "?"
159-
>>> bimap splitSegments (splitAt (flip Tuple "") "#" >>> lmap splitParams)
158+
splitAt (flip Tuple "") "#"
159+
>>> lmap splitPath
160160
>>> toRouteState
161161
where
162+
splitPath =
163+
splitAt (flip Tuple "") "?"
164+
>>> bimap splitSegments splitParams
165+
162166
splitSegments = splitNonEmpty (Pattern "/") >>> case _ of
163167
["", ""] -> [""]
164168
xs -> map unsafeDecodeURIComponent xs
@@ -172,7 +176,7 @@ parsePath =
172176
splitNonEmpty _ "" = []
173177
splitNonEmpty p s = split p s
174178

175-
toRouteState (Tuple segments (Tuple params h)) =
179+
toRouteState (Tuple (Tuple segments params) h) =
176180
{ segments, params, hash: h }
177181

178182
splitAt k p str =

0 commit comments

Comments
 (0)