Fork me on GitHub

How many of these "special namespace"s are there and where can I find them?

Pavel Klavík16:12:04

Hi, I am using accountant library with bidi for client-side routing. In the main function, I am initializing it like this:

    {:nav-handler       #(rf/dispatch [:app-state/changed-route %])
     :path-exists?      #(contains? #{:app/index :app/help}
                                    (:handler (b/match-route routes/routes %)))
     :reload-same-path? false})
I have several problems with it: 1. Clicking on back and forward buttons in the browser changes the URL, but does not call :app-state/changed-route event. So it is ignored by the app. 2. When I remove :reload-same-path?, each click on a link called :app-state/changed-route multiple times. But I want to allow reloading the same path to the user. 3. Sometimes :app-state/changed-route is called multiple times anyway when I reload the page.


I intend to write a DRY .cljc test that uses cljs.test/async in its :cljs branches. The code should run in JVM clojure as well, but the async helper does not exist there. Wondering if someone has tackled this problem before, maybe with some cool macro?


Something along these lines will probably do the trick

(defmacro def-async-test
          {:style/indent 1}
          [name & args]
          (assert (symbol? name))
          (let [clj? (-> &env :ns nil?)]
            (if clj?
              `(deftest ~name
              `(cljs.test/deftest ~name
                 (cljs.test/async done#

Sam Ferrell22:12:33

How do people like to organize their view components in a CLJS project? One file and namespace per component? Single namespace with a file per component?

Pavel Klavík23:12:22

@samcferrell We do it the same as with everything else in code. In some situation, a complicated component might be placed in multiple files. In some situation, multiple simple related components placed in one namespace. As the project grows, it makes sense to start grouping components together into nested namespaces.