Fork me on GitHub

EVERYONE If you haven't seen this clojureWest talk, it is worth a look:


Posh looks great! And so does the overall approach from Christopher Small


I've probably drunk too much FRP koolaid in the past, but something that would be kind of nice: my component requires two subscriptions, and therefore (if I understand correctly) will re-render if either of them changes. However, I mainly care about one of those subscriptions: I definitely want to re-render if this VIP subscription changes (in which case, might as well grab the second non-VIP subscription), but if only the second non-VIP subscription changes, don't bother re-rendering. Can I express this with re-frame currently?


@fasiha: only if you are evil ...


Instead of doing @r or (deref r) for the less important ratom, you could use (swap! r identity) ... an expression which yields the value in the ratom without derefing it, in such a way that the component does not capture it as an "Input Signal".


But if you ever use this technique you have to let out a maniacal, evil laugh. That's the rule.


You could also do this (_peek-at r) instead of @r or (deref r). This one only requires a sinister guffaw.


@fasiha: could you please explain your use case? Just interested. Is it for performance gain?


@fasiha: you can capture the state of second subscription on change of first, just write some middleware for handler that updates data for first subscription.


whats the best way to perform something based on the success/failure of a dispatch? i.e redirect after a successful ajax request in a dispatch (from the dispatch caller).


@mikethompson: ah, _peek-at is a Reagent thing, not a re-frame thing, it seems like it does the same thing as the evil laugh route with swap! but merits only a sinister guffaw because it at least is somewhat obvious what you're doing?


@nidu, not sure if this will make sense but: subscription 1 is other players' position, subscription 2 is my own position. I calculate the distance between my own position and each of the other players (requires sqrt and pow and expensive math) to sort a list of player positions closest-to-farthest. My own position changes very slowly relative to other players, so I'd prefer to calculate this expensive list of distances only if another player's position changes. Hmm, that's interesting, for the ultimate in performance savings, I should recalculate the distance only to the player that's changed, not all of them. The way it works now is one or two players' positions will be updated by a handler at a time, so the view will actually be recomputing the same distances over and over again, of players who haven't moved… 😖


(Also my conscience requires me to say: I'm not writing a game, I'm writing a serious app for airplane pilots 😋)


What I think I will do is move the distance-to-self calculation into the handler that updates other players' positions and circumvent this whole problem. A bit of complection never hurt anyone right? Right??


@rasom, that is truly awesome, as usual Clojure/re-frame blows my mind


@afhammad: I put the complete call to the re-frame dispatch handler in the AJAX request:

(xhr/send (str "/path/" id)
          #(r/dispatch [:received-data (-> % .-target .getResponseText)]))


@fasiha: does it solve your issue?


@afhammad: (With (require '[ :as xhr] '[re-frame.core :as r]).) The :received-data handler will deal with success/error.


@rasom, after describing it above, I realized that even with that kind of data-capturing re-frame middleware, I'll still be repeating (potentially many) computations needlessly, so I'm just going to move the expensive computation from the view to the handler that initially gets that data.


@mikethompson: I saw your note in #C0620C0C8 if I update that, and use the latest re-frame version 0.7.0, will I get React 15 in re-frame? I see your note in the Reagent github issue, looks like it will 😄


Anyone tried to use Google's Material Design Lite with reagent/reframe?


There's a trick to "materialize" DOM objects when they are dynamically added


Anyone ever run into something like this with their handlers.cljs? Thousands of lines of this repeating:

at clojure.core$reduce.invoke(core.clj:6518)
        at cljs.analyzer$analyze_STAR_.invoke(analyzer.cljc:2573)
        at cljs.analyzer$analyze.invoke(analyzer.cljc:2588)
        at cljs.analyzer$analyze_file$fn__2041.invoke(analyzer.cljc:2838)
        at cljs.analyzer$analyze_file.invoke(analyzer.cljc:2833)
        at cljs.analyzer$analyze_deps.invoke(analyzer.cljc:1654)
        at cljs.analyzer$ns_side_effects.invoke(analyzer.cljc:2492)
        at cljs.analyzer$analyze_STAR_$fn__1990.invoke(analyzer.cljc:2573)
        at clojure.lang.PersistentVector.reduce(


@tom: circular dependency maybe?