om

Please ask the channel first, not @dnolen directly!
souenzzo 2017-10-06T02:55:30.000073Z

(defmethod mutate 'add/user
  [{:keys [state]} _ user]
  {:value  {:keys [:user/list]}
   :action (fn [] (d/transact! state [user]))})
When this event occours, It should update :user/list, not? (not updating here)

souenzzo 2017-10-06T02:56:13.000128Z

But when I call (om/transact this [('add/user ~user) :user/list]), the user's list get updated

souenzzo 2017-10-06T02:57:09.000146Z

I'm missing something?

levitanong 2017-10-06T09:28:54.000242Z

wait

levitanong 2017-10-06T09:29:27.000244Z

@souenzzo what is d/transact!?

levitanong 2017-10-06T09:30:08.000089Z

is that datascript?

souenzzo 2017-10-06T11:55:52.000050Z

Yep.

souenzzo 2017-10-06T12:02:03.000279Z

I'm missing tempids?

levitanong 2017-10-06T12:06:29.000230Z

@souenzzo if you are making the call to add/user in a component other than the one querying :user/list, there is a big chance that it won’t update. Specifying :user/list in your mutate explicitly ensures that it re-renders.

souenzzo 2017-10-06T12:08:48.000124Z

So that value {keys} on mutate will just work when I'm in the same component?

levitanong 2017-10-06T12:14:18.000028Z

the :value on mutate does nothing beyond self-documentation

👍 1
souenzzo 2017-10-06T12:26:59.000190Z

And that tempids stuff on this value attribute?

levitanong 2017-10-06T12:34:43.000172Z

i’m aware that datascript and datomic return mappings of tempids to canonical ids, but i’m not sure how this question is relevant.

souenzzo 2017-10-06T13:12:13.000341Z

https://github.com/omcljs/om/wiki/Quick-Start-(om.next)#a-mutation-function "`tempids` will be discussed later" No docs about tempids (maybe later in time 😛 )

levitanong 2017-10-06T13:34:23.000306Z

AFAIK, tempid resolution is on stuff like, if you make a new Thing, and you want to have some identifier, you’d use (om/tempid), send that over to the server, which would resolve that tempid into a real id, and the result of that (datomic) transact would be a mapping from tempid to real id. So in the POST response that you get clientside will include that mapping, then you can pass that into your cb or merge (to be confirmed), and that will automatically switch over those tempids to the real ids.

levitanong 2017-10-06T13:34:41.000390Z

afaik that doesn’t really have anything to do with datascript