Thanks, Taylor. I'd seen path. It doesn't do what I need, but after reviewing 
and thinking about it, it may be a good part of a solution. Mainly what is the 
hard part is dealing with a tree of nested maps/vectors. You won't necessarily 
know the path until run-time, and certainly don't want to rely on the index 
location in a vec in case there have been data transformations along the way to 
the view code. So, when updating a value in the view and sending that value 
back to app-db, I need to be able to reliable find the correct item in the tree 
and update it. 

I've been playing with my own naive code, clojure.walk and zippers. I find 
zippers conceptually understandable, but practically daunting. However, I came 
across this link, which does what I'm looking for:

https://gist.github.com/renegr/9493967

I'm curious how other users of Reagent and Re-Frame (and Quiescent) and 
handling the updating of app-db trees more complex than a simple one-level map.

Cheers,

Jamie

On Mar 25, 2015, at 2:17 PM, Taylor Sando <[email protected]> wrote:

> There was handler middleware for helping with deeply nested structure
> 
> middleware/path
> A middleware factory which supplies a sub-tree of `db` to the handler.
>  Works a bit like update-in. Supplies a narrowed data structure for the 
> handler.
>  Afterwards, grafts the result of the handler back into db.
>  Usage
> 
> https://github.com/Day8/re-frame/blob/master/src/re_frame/middleware.cljs
> 
> So if your data is at :path :to :value, you could have a middleware handle 
> definition like:
> 
> (register-handler :some/key (path [:path :to :value]) hander-fn)
> 
> Then handler-fn would be passed the value, and all you need to return is the 
> updated value from the handler-fn, it will be placed into the app at the path 
> location.
> 
> -- 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to