Fork me on GitHub
#re-frame
<
2016-03-14
>
mikethompson12:03:51

For those that use the offical re-frame debug middleware ... we're switching to use a version which looks like this:

(defn my-debug
  "Middleware which logs debug information to js/console for each event.
  Includes a clojure.data/diff of the db, before vs after, showing the changes
  caused by the event."
  [handler]
  (fn debug-handler
    [db v]
    (.log js/console (str "%cre-frame event: " v) "font-size: 125%; background: #888; color: white")
    (let [new-db  (handler db v)
          diff    (data/diff db new-db)]
      (.groupCollapsed  js/console "clojure.data/diff for: " v)
      (.log js/console "only before: " (first diff))
      (.log js/console "only after : " (second diff))
      (.groupEnd js/console)
      new-db)))
Features: 1. via styling, really highlights new events in console, which makes it easier to grok what is happening. 2. No longer hides all console output for an event handler in a console "group". Which used to be confusing sometimes. Hey where did my debug print go?? Oh, its hidden down in that closed group. 3. Outputs cljs values to console (rather than strings), allowing cljs-devtools to be better used.

mikethompson12:03:02

Remember the "official middleware" are just examples. You can write your own. Then add them to your own handlers.

mikethompson12:03:06

A new re-frame version will be in clojars in about 7 hours from now (just as soon as someone wakes up).: Nothing very sensational in it. Just a small, incremental advance. Specifics: https://github.com/Day8/re-frame/blob/master/CHANGES.md#070--2016-03-14

martinklepsch14:03:11

> debug middleware now produces slightly different output (to console). So no code will need to change, just your expectations of what you see in console. Previously all console output from an event handler was put into the one console group, which could lead to exceptions being hidden (down in a closed group).

not-much-io15:03:36

I have a question regarding https://github.com/Day8/re-frame-template . Am I understanding this right, that the template is meant for JUST a frontend? As "cljsbuild once min" will just build the js and the application will have nothing to connect to without figwheel?

not-much-io15:03:44

Also related, any tips on deploying an app made with this template to heroku?

not-much-io15:03:26

+heroku is a desire profile, but alas..

cky17:03:15

@not-much-io: I don’t have a lot of experience with re-frame-template but I have a re-frame app that uses reagent-template (which does include a backend).

mikethompson21:03:11

re-frame-template is aimed just at producing an SPA using re-frame, re-com and garden - but no backend server. Hmm. My information might be out of date. Looking again, I notice that there's a +compojure option which might, these days, include some server code.

cky21:03:14

Frankly, the reason I chose reagent-template over re-frame-template wasn’t the presence of backend, but rather the presence of the +sass option. 😉

cky21:03:37

because I was just too lazy to try to wire up Sass support, but it was easy to wire in re-frame support atop reagent-template.