Use transact! if you need to operate on the previous value in order to
update, use update! if you want to replace the previous value. No plans to
change the tutorials as far as this is concerned.

David


On Thu, Apr 24, 2014 at 2:50 PM, Paul Butcher <[email protected]> wrote:

> Having quite correctly had my wrist slapped by David for opening a ticket
> to ask a question (sorry David - that arose from broken logic following my
> discovery that there’s no such thing as a pull request for wiki pages - I
> didn’t want to just change the wiki pages without asking first, and for
> some reason I thought that a ticket would be the next-best thing) I’ll ask
> the question here.
>
> There are a number of places where the Om tutorials use transact! where
> they could use update!. For example, in the basic tutorial:
>
> (defn handle-change [e text owner]
>   (om/transact! text (fn [_] (.. e -target -value))))
>
>
> could be:
>
> (defn handle-change [e text owner]
>   (om/update! text (.. e -target -value)))
>
>
> The fact that the tutorials consistently use transact! leads me to wonder
> whether there’s a good reason for this (and that I should do the same in my
> own code). Although that then raises the question of why update! is in the
> Om API at all.
>
> Alternatively, would it make sense to modify the tutorials to use update!
> when possible? Which would be (to my eye) easier to read and avoid others
> from facing the same dilemma?
>
> --
> paul.butcher->msgCount++
>
> Silverstone, Brands Hatch, Donington Park...
> Who says I have a one track mind?
>
> http://www.paulbutcher.com/
> LinkedIn: http://www.linkedin.com/in/paulbutcher
> Skype: paulrabutcher
>
> Author of Seven Concurrency Models in Seven Weeks: When Threads Unravel
> http://pragprog.com/book/pb7con
>
> --
> 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