Merge pull request #300 from nextjournal/html5-hist-fragments

Pass uri fragments to history pushState
This commit is contained in:
Juho Teperi 2019-09-20 10:39:29 +03:00 committed by GitHub
commit 99ea1ef091
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -109,8 +109,10 @@
(when (ignore-anchor-click-predicate router e el uri) (when (ignore-anchor-click-predicate router e el uri)
(.preventDefault e) (.preventDefault e)
(let [path (str (.getPath uri) (let [path (str (.getPath uri)
(if (seq (.getQuery uri)) (when (.hasQuery uri)
(str "?" (.getQuery uri))))] (str "?" (.getQuery uri)))
(when (.hasFragment uri)
(str "#" (.getFragment uri))))]
(.pushState js/window.history nil "" path) (.pushState js/window.history nil "" path)
(-on-navigate this path))))))] (-on-navigate this path))))))]
(-on-navigate this (-get-path this)) (-on-navigate this (-get-path this))