Fork me on GitHub
#reitit
<
2020-07-16
>
nick10:07:32

(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?

juhoteperi10:07:34

or using reload hook or something

nick10:07:09

(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

juhoteperi10:07:30

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

nick10:07:10

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!