diff --git a/examples/frontend/src/frontend/core.cljs b/examples/frontend/src/frontend/core.cljs index 4f4d9276..dee5c817 100644 --- a/examples/frontend/src/frontend/core.cljs +++ b/examples/frontend/src/frontend/core.cljs @@ -28,17 +28,13 @@ (def routes (rc/router - ["" + ["/" ["" - {:name ::frontpage-root + {:name ::frontpage :view home-page}] - ["/" - ["" - {:name ::frontpage - :view home-page}] - ["about" - {:name ::about - :view about-page}]]])) + ["about" + {:name ::about + :view about-page}]])) (defn init! [] (reset! router (rfh/start! routes diff --git a/modules/reitit-frontend/src/reitit/frontend/history.cljs b/modules/reitit-frontend/src/reitit/frontend/history.cljs index 0ef39c2e..e451d212 100644 --- a/modules/reitit-frontend/src/reitit/frontend/history.cljs +++ b/modules/reitit-frontend/src/reitit/frontend/history.cljs @@ -13,7 +13,11 @@ (defn- token->path [history token] (if (.-useFragment_ history) - token + ;; If no fragment at all, default to "/" + ;; If fragment is present, the token already is prefixed with "/" + (if (= "" token) + (.getPathPrefix history) + token) (str (.getPathPrefix history) token))) (defn- path->token [history path]