Fork me on GitHub

It is a real delight for me to see a steady trickle of job descriptions mentioning re-frame. Here are two current ones: Knowing re-frame might actually help you to get a nice job these days!!


I have just bashed out a quick update to the testing doc: It probably contains typos. Any extra eyes on it, with fixes would be appreciated.


another job description with re-frame for your fridge @mikethompson from my company 😄 (though we already filled this position)


I often get warnings like this when using re-frame on react-native: <Warning>: 're-frame: overwriting', ':event', 'handler for:'


after reloading with figwheel. Am I doing things wrong, or is that normal?


it's more obvious on react-native because console.warn triggers a very loud Yellow Box on the bottom of the screen


Yeah, when figwheel reloads the file, all the registrations in that file are redone. But re-frame can't be sure if reregistering a handler is a bug or not


so the case you want to catch is where there are multiple event handlers for the same key, perhaps in different namespaces?


@danielcompton did get someway towards a solution. Can't remember why we left it.


How do I fire an event on "load complete"? I want to focus the main input field when the browser is ready.


"When the component is rendered": "When the page finishes to load" window.onload = (e) => {}


But sure, on "input", it's autofocus props


lein ancient tells me that reagent 0.7.0 is available (I am using 0.6.2). Is that compatible with re-frame 0.9.4 ?


@burke That's nice! Thanks 🙂


Hmm, I can't get the autofocus attribute in the HTML. [:input {:auto-focus true :type "text"}} doesn't do it - that just renders as <input type="text">.


in html it is expected that autofocus does not have a value. But in xhtml standard it should have the value "autofocus", so maybe you try {:autofocus "autofocus" :type "text"}


Ah. I was expecting the autofocus attribute to appear in the HTML, but actually React handles it, and :auto-focus true works fine.


okay 🙂


@mbertheau was that reply to me?


@sandbags Yes, re-frame 0.9.4 is compatible with reagent 0.7.0.


But it didn’t go too far


anyone have experience pushing reframe /cljs in general really hard? like .. how abusive can you be about reactive flowing data before you start to miss frames?


I've pushed Om really really hard and never hit a performance bottleneck


I would expect the same from reagent, and even better performance from reframe


that’s good to hear. I guess I will find out how well reframe does. i’m essentially doing a O(n^2 * 4) every time there’s a change in any of 4 collections


but the implementation of the brute-force approach is about 4x less complex than any other way I can think of 🙂


i’m wondering if I could do a “true frp” approach with this feature i’m developing.. where I have two sets of base data, and two sets of “stateful data” that I apply on top each time any of the 4 sets change

doug kirk23:07:02

If I'm understanding correctly, you can use Reagent's track to merge base- and state- data and have it look like a ratom:

(defn combined-data
  (let [base @(rf/subscribe [:base-data])
        state @(rf/subscribe [:stateful-data])]
     (merge base state)))


(let [combined (r/track combined-data)] ...)
in which combined is a ratom with the merged data.


I think my problem is I want this magic to happen without someone having to deref in that (let [combined ...? though now that you mention it i can just deref inside a subscription, maybe. after hours of experimenting the timing seemed a little iffy and felt more and more like a hack