Fork me on GitHub
#re-frame
<
2019-03-03
>
sveri14:03:55

Hi, I am using re-frame and shadow-cljs for development. Now, whenever I change the function of subscription the code is not updated in the browser. any idea what I need to do here? Updating UI works as expected.

sveri14:03:23

I can see that an update is happening in the developer console of the browser:

sveri14:03:48

Also for my sub in question: `re-frame: overwriting :sub handler for: Object { ns: "de.sveri.getless.banking.subs", name: "selected-range", fqn: "de.sveri.getless.banking.subs/selected-range", hash: -791936506, "cljs$lang$protocolmask$partition0$": 2153775105, "cljs$lang$protocol_mask$partition1$": 4096 }`

sveri15:03:12

I can reproduce this with these few lines if someone wants to try:

(rf/reg-event-db
  ::initialize-db
  (fn [db _]
    (-> db
        (assoc :foobar "state"))))

(rf/reg-event-db
  ::s-changed
  (fn [db _]
    (-> db
        (assoc :foobar (str (rand-int 10))))))


(rf/reg-sub
  ::foobar
  (fn [db _]
    (println "werwer")
    (-> db :foobar)))


(defn ui []
  (let [s (<sub [::foobar])]
    [:h3
     {:on-click #(>evt [::s-changed])}
     s]))


(defn render []
  (reagent/render [ui] (js/document.getElementById "banking_js")))

(defn ^:export run []
  (rf/dispatch-sync [::initialize-db])
  (render))

abdullahibra15:03:55

what is the best way to upload file as re-frame dispatch event ?