clj-commons / secretary

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

Ordering dynamically added routes? #96

Open smitch88 opened 7 years ago

smitch88 commented 7 years ago

Situation: I have initial routes set up on app load. I add some additional routes dynamically based on a configuration using add-route!. I noticed that since I defined a catch-all in the initial routes, namely /*, that this gets matched on before any of the dynamically added routes. I assume this is because the vector of routes is in insertion order?

Is there a way to handle dynamic ordering in the library that I'm not seeing? Or do I need to manipulate the *routes* directly for now?

smitch88 commented 7 years ago

To anyone else with a similar issue...I ended up just adding an additional function prepend-route! that adds to the front of *routes* instead.