Fork me on GitHub

I was thinking of using a dashboard template built using react and next that would run on a node.js server. I’m trying to do something even using serverless tech. Does re-frame use next.js at all? Does it make sense to import next.js? or components from react.js?


I'm trying to test an app that uses enzyme and having some struggles. The stack is: [cljsjs/react "16.4.1-0"] [reagent "0.8.1"] [re-frame "0.10.5"] Turns out enzyme needs TestUtils (which moved out of React add-ons) As cljsjs is out of date for enzyme and doesn't have enzyme-adapter-react-16 (and I later got this error) Error: Cannot find module '@cljs-oss/module-deps' as in I added these keys to my [:cljsbuilds :build :test :compiler] options

:npm-deps {"@cljs-oss/module-deps" "1.1.1"
                                :enzyme "3.4.4"
                                :enzyme-adapter-react-16 "1.2.0"}
                     :install-deps true
and this to the namespace where I use enzyme:
(ns my-test.enzyme
  (:require [enzyme :refer [configure]]
            [enzyme-adapter-react-16 :refer [Adapter]]))

(js/enzyme.configure (clj->js {:adapter: (js/Adapter.)}))
I see Bruce worked around this in figwheel (by reading the cljs_deps.js file) But now my symptom is Error: module not found: "./util.inspect" from file /[...]/node_modules/object-inspect/index.js Thoughts? Or, is anyone testing re-frame apps on React 16?


Good morning! Having great fun with re-frame, and again am amazed at how easy it has been to add functionality to my application, without my code collapsing in on itself like has been my experience for decades. :) You may recall, I was wondering a year ago if my events.cljs was too large at 500 lines — it’s now over 1500 lines, and for me, it’s still easy enough understand to quickly add features here and there. I’m amazed at how re-frame enables this... But for the first time, I’m adding two namespaces and two entry points. Like the “login” and “shopping-cart” example in In my case, it’s to have a standard JS app, and another for my iPhone. Currently, I do the user-agent detection in the server, and send the client to either /app, or /iphone, which in the HTML does a “app.core.init()” or a “iphone.core.init()”. I’m still trying to figure out how to get everything configured properly — I initially had a whole new set of Lein profiles ({:dev, :min} => {:dev, :min, :dev-iphone, :min-iphone}, each with it’s own :on-jsload, so that it would hot reload properly. I think this worked, but abandoned this because it doubled build times (I think?), and was pretty sure this wasn’t the right way to proceed... I’ve collapsed it back to two profiles {:dev, :min}, and run “app.core.init()” or “iphone.core.init()” from the HTML, but hot reloading causes the entire app to blank out — I’m almost certain it’s because :on-jsload is not set correctly. (There can only be one :on-jsload setting per profile in project.clj...) What is the best way support multiple entry points, and still have hot reloading work? Thanks in advance!


What does your :on-jsload do now?


Does anyone have examples of re-frame interceptors that actually do something with :queue and/or :stack


I have example that makes queue empty if http response is forbidden/unauthorized and dispatches logout:

(ns app.interceptors
   [re-frame.core :as re-frame]))

(def restricted
  "Logs out current user if he is not authorized to perform the request.

  Should be registered early, as it skips other interceptors."
   :id :restricted
   :before (fn [context]
             (let [coeffects (:coeffects context)
                   result (last (:event coeffects))
                   token (get-in coeffects [:db :auth :token])]
               (if (or (not token) (contains? #{401 403} (:status result)))
                 (-> context
                     (assoc :effects {:dispatch []})
                     (update :queue empty))


Makes sense. In fact I just realized we have a similar interceptor in our work project, I just had forgotten about it 🙂


@miikka Earlier, it was…

   [{:id           "dev"
     :source-paths ["src/cljs"]
     :figwheel     {:on-jsload "app.core/mount-root"}
Currently, I have it set to something I know doesn’t work:
   [{:id           "dev"
     :source-paths ["src/cljs"]
     :figwheel     true
Trying to figure out the right way to specify multiple entry points?


Using, apollo and re-frame, I have everything working fine during dev. Whenever I deploy to a production environment, it fails:

(defn activity-select [options]
      [:> react-select {:clearable false
                        :onChange  (fn [new-value]
                                     (let [activity-id (.-value new-value)]
                                       (.then (query/activity-by-id-query activity-id)
                                              (fn [success]
                                                (-> success .-data .-Activity (js->clj :keywordize-keys true) deserialize
                                                    (#(re-frame/dispatch [... %]))))
                                              (fn [error]
                                                (println "failed to query: " error)))))
                        :multi     false
                        :options   options
                        :value     (-> @(re-frame/subscribe ...])
                                     (#(filter (comp #{%} :value) options))
All works well during dev/test, but in a production environment, after selecting an 'activity', the selection box is empty and the re-frame subscription is nil, even though it's been dispatched.


I have no clue why...


I now do: in advanced compilation, things like (-> success .-data .-Activity ...) are messed up