looks good!
So the atom-sync
middleware can also be used for resetting the model from the REPL, right?
@metametadata: another improvement that came to mind: it would be nice if you could give a white/blacklist of keywords to the logging middleware. I really don't want it to log what happens in the debugger 🙂
I guess this is a minor issue though, but still
yes, for REPL you'll have to create your own external "model atom" and connect it with the app via the middleware, smt like this:
(def repl-model (atom (:initial-model my-spec))
(def my-app (carry/app (-> my-spec (atom-sync/add repl-model))))
; ...
then after app is started repl-model
will behave as if it was a model atom.To fix logging try changing the order of applying logging
and debugger
middleware.
If applied last, logging
middleware will catch all the signals:
(-> spec ... (debugger/add ...) logging/add)
And this way logger won't see debugger's signals and actions, because they don't propagate into the debugged app:
(-> spec ... logging/add (debugger/add ...))
ohh
cool!
should document that
any plans on adding a spec middleware btw?
Though I was thinking that one good way to develop an app with carry would be that you define a plumatic schema for your whole model, and clojure.specs for individual functions
OK I'll prob add this into faq or user guide
I haven't digged into core.spec yet
@kauko: carry-atom-sync
middleware is extracted and there's an example of using it with Devcards/Reagent in counter-devcards
. Doc updates are on the way.
https://github.com/metametadata/carry/tree/master/contrib/atom-sync
wohoo 🙂