secretary icon indicating copy to clipboard operation
secretary copied to clipboard

Query params in named routes

Open ostronom opened this issue 10 years ago • 4 comments

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.

ostronom avatar Feb 20 '15 17:02 ostronom

That seems interesting considering this is thoroughly tested. Some more context would be helpful (if this is still an issue).

noprompt avatar Feb 27 '15 05:02 noprompt

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

julienfantin avatar Jun 11 '15 19:06 julienfantin

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.

noprompt avatar Jun 12 '15 17:06 noprompt

FWIW I just ran into this issue. query-params were coming back as nil until I used the history config in the above gist.

mking avatar Dec 18 '15 09:12 mking