secretary
secretary copied to clipboard
Query params in named routes
Given this route definition:
(defroute exchange-link "/exchange" [z]
(println "route params" z))
and this invokation:
(sec/dispatch! "/exchange?a=b")
I'm getting:
route params nil
instead of
route params {:query-params ... }
(defroute exchange-link "/exchange" {:keys [query-params]}
(println "route params" query-params))
gives the same result.
That seems interesting considering this is thoroughly tested. Some more context would be helpful (if this is still an issue).
The secretary readme describes a google closure history config that discards the query params from the token. This is visible if you log the navigation event.
A better alternative is described here: https://gist.github.com/pleasetrythisathome/d1d9b1d74705b6771c20#file-browser-cljs-L11
The secretary readme describes a google closure history config that discards the query params from the token.
@julienfantin I don't recall this being an issue but if it is we apologize. If you'd like to update the README and examples with something better please do.
FWIW I just ran into this issue. query-params were coming back as nil until I used the history config in the above gist.