clj-commons / secretary

A client-side router for ClojureScript.
773 stars 64 forks source link

defroute default-route overrides everything after it #89

Closed vans163 closed 7 years ago

vans163 commented 7 years ago

Once you specify defroute default-route, any defroutes after it get ignored.

I thought default-route was special for this reason that it would not override things like this.

RyanBertrand commented 7 years ago

Do you mean a wildcard route?
(defroute "*" {:as params})

If so, I always put this last in my list of defroutes as a catch all. I believe they are tested in order.

vans163 commented 7 years ago

I believe this is my mistake, I am new to clojurescript I thought the http://www.lispcast.com/mastering-client-side-routing-with-secretary-and-goog-history "defroute default-route" was special here.

The usecase was if you have a few namespaces, it becomes hard to track which one gets included first. With a default-route, if it came before other routes yet did not override the future routes; would be but a convenience.

gf3 commented 7 years ago

indeed they are tested in order—you should place it at the end