Fork me on GitHub
#om
<
2017-06-15
>
ag00:06:48

Damn it, I'm confused again: If I need a perform remote mutation and depending of what result of that mutation, shuffle things in the state atom. If I do

defmethod mutate 'foo/fire-missiles!
[_ _ _]
{:remote true
:action (fn []
          ;; read the state,
          ;; adjust thee state based on value of (get @state 'foo/fire-missiles!)
        )}

;; an on the back:

defmethod mutate 'foo/fire-missiles!
[_ _ _]
{:value (fire-missiles-result)}
I thought this would work, but it doesn't as expected. I have to transact it twice.

ag00:06:54

how do I handle things that happen AFTER successful mutation on the server? I need to mutate local state then

ag00:06:26

I can't seem to be able to do that in :action fn, it happens before remote mutation

ag01:06:34

or can I anyhow impact other keys from remote mutate method?

ag01:06:44

something like

defmethod mutate 'foo/fire-missiles! [_ _ _]
{:value {:yes-it-fired true}}
is there a way (without using custom merge fn) to force the novelty to appear in the top-level key :yes-it-fired?

matthavener01:06:35

you can send back any novelty you want from a remote mutate

levitanong16:06:14

Is there any special way to pass parameters to a read I’m om/forceing?

levitanong16:06:22

oops, scratch that, I had a typo 😛