reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
nick 2020-07-16T10:23:32.290200Z

(def routes
  ["/"
   ;; any routes like this one(no params coercion) work fine with figwheel reloading
   ["upload-files" {:name        :routes/upload-files
                    :view        upload-files/page
                    :controllers [{:start (fn [_] (rf/dispatch [:page/init-upload-files]))}]}]

   ;; any updates to routes like this one(hiccup in upload_files_show/page) are never detected
   ;; the only way is to rerun lein shadow watch app which is super slow
   ["upload-files/:id" {:name      :routes/upload-files-show
                       :view        upload_files_show/page
                       :coercion reitit.coercion.malli/coercion
                       :params {:path [:map [:id number?]]}
                       :controllers [{:parameters {:path [:id]}
                                      :start (fn [{:keys [path]}]
                                               (rf/dispatch [:page/init-upload-file (:id path)]))}]}]
  ])

(def router
  (reitit.frontend/router
    routes
    {:data {:coercion reitit.coercion.malli/coercion}}))
project.clj:
[thheller/shadow-cljs "2.9.2" :scope "provided"]
                 [metosin/reitit "0.4.2"]
                 [metosin/reitit-malli "0.5.3"]
Perhaps anyone has seen something like this before? Any ideas on what I can try to get this fixed?

juhoteperi 2020-07-16T10:25:24.290600Z

@nfedyashev Are you reinitializing the router on main ns reload? https://github.com/metosin/reitit/blob/master/examples/frontend-re-frame/src/cljs/frontend_re_frame/core.cljs#L144-L153

juhoteperi 2020-07-16T10:25:34.291Z

or using reload hook or something

nick 2020-07-16T10:26:09.291300Z

(defn ^:dev/after-load mount-root []
  (rf/clear-subscription-cache!)
  (routes/init-routes!)
  (rdom/render [views/root] (.getElementById js/document "app")))

(defn init! []
  (ajax/load-interceptors!)
  (mount-root))
in core.cljs

juhoteperi 2020-07-16T10:27:30.291800Z

Looks ok. Maybe something in views/root or wherever you are rendering the current view ?

nick 2020-07-16T10:52:10.295100Z

Sorry, that's my bad. It had nothing to do with reitit. Resource does not have expected namespace {:tag :shadow.build.resolve/unexpected-ns, :resource "app/ui/views/voter_files_details.cljs", :expected-ns app.ui.views.voter-files-details, :actual-ns app.ui.views.voter_files_details} @juhoteperi thanks for your help!