This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-16
Channels
- # alda (1)
- # aws-lambda (1)
- # bangalore-clj (1)
- # beginners (70)
- # boot (24)
- # cider (1)
- # cljs-dev (167)
- # cljsjs (8)
- # cljsrn (17)
- # clojure (224)
- # clojure-android (7)
- # clojure-austin (8)
- # clojure-russia (17)
- # clojure-spec (120)
- # clojure-uk (46)
- # clojurescript (68)
- # community-development (198)
- # conf-proposals (1)
- # core-async (7)
- # cursive (6)
- # datomic (27)
- # dirac (19)
- # events (9)
- # hoplon (2)
- # jobs (1)
- # luminus (9)
- # off-topic (1)
- # om (281)
- # om-next (5)
- # onyx (50)
- # pedestal (1)
- # re-frame (19)
- # reagent (11)
- # ring-swagger (14)
- # slack-help (2)
- # spacemacs (1)
- # untangled (72)
- # yada (30)
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?
@andre looks great, there's also https://github.com/matthiasn/inspect and https://gist.github.com/jakemcc/61ee9535bd0bbb4845f6050122547b32 . The thing I miss from these is the edit capabilities like https://github.com/noprompt/ankha has.
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 for...at the moment I am personally using https://github.com/Odinodin/data-frisk-reagent
@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:
(reg-event-db
:clear-completed
(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 https://github.com/Day8/re-frame-undo, 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.
(reg-event-db
:clear-completed
[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. š