Fork me on GitHub

Iā€™m starting to enjoy Re-frame. Just saying šŸ™‚


Hi, I upgraded reagent from 0.5.0 to 0.6.0 and now I get "Reaction is read only" which I did not see before. How do I make a mutable ratom from a subscription?


my lib is specially for the re-frame, it analyzes clojure code and generates re-frame pattern data structures


so if you have re-frame view (component ) , it automatically shows subscriptions and dispatches related this view (component)


It looks cooler and a bit more targeted to re-frame apps, which is what I was looking the moment I am personally using


yes, i'm using this lib to render data


@andre: Is that open source? Looks very interesting and useful!


if you are interesting guys i will make some cosmetic improvements and open source it, i want to add code tooltips to see query (sub) code


@andre: Very interested, that would be great!


I'm trying to add an undo button to the re-frame todomvc example. After reading the new tutorial on Interceptors, it's my understanding that a chain of interceptors is just a vector. Further, the undo function is just an interceptor. Therefore I should be able to add it to an existing vector of Interceptors, like so:

 (conj todo-interceptors (undoable "un-clear all completed))
  (fn [todos _]
    (->> (vals todos)                ;; find the ids of all todos where :done is true
         (filter :done)
         (map :id)
         (reduce dissoc todos))))    ;; now delete these ids


And then, going by the undo documentation at, I should just be able to fire off the pre-defined #(dispatch [:undo]) function.


With all this in place, the button hasn't un-done, it seems šŸ˜‰


Actually I'm wrong - (undoable) is an Interceptor factory, not an Interceptor. So I'd expect it to behave differently.


Which still leaves me wondering how to add it to an existing chain of interceptors at the top of an event handler.



  [todo-interceptors (undoable "clear all completed")]                    ;; <--   should work 
  (fn [todos _]
    (->> (vals todos)                ;; find the ids of all todos where :done is true
         (filter :done)
         (map :id)
         (reduce dissoc todos)))) 


Note: you can compose interceptors like this: [interceptor1 interceptor2 [interceptor3 interceptor4]] (notice the nested vectors). re-frame will flatten the structure and remove nils. That's why you can put todo-interceptrors into a further wrapping vector - no need for conj. Note: you would normally give a string which describes the action (not the undo of the action). Later you can give them the option to undo "clear all completed".


Throwing a couple re-frame proposals (one in so far, one still to come) into the #conf-proposals channel if anyone is interested in giving feedback.


@mikethompson Thanks a lot, it worked! How exciting, though I coulda sworn I'd tried that one. And I've made note of your notes. šŸ˜Ž