This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-06
Channels
- # beginners (32)
- # boot (17)
- # cider (4)
- # clara (112)
- # cljs-dev (3)
- # cljsjs (2)
- # clojure (222)
- # clojure-germany (3)
- # clojure-greece (1)
- # clojure-italy (4)
- # clojure-losangeles (4)
- # clojure-russia (46)
- # clojure-spec (24)
- # clojure-uk (71)
- # clojurescript (78)
- # community-development (5)
- # component (88)
- # cursive (6)
- # datomic (7)
- # duct (5)
- # figwheel (2)
- # fulcro (21)
- # graphql (22)
- # leiningen (3)
- # luminus (9)
- # off-topic (1)
- # om (16)
- # onyx (46)
- # portkey (30)
- # re-frame (47)
- # reagent (5)
- # remote-jobs (1)
- # ring (12)
- # ring-swagger (13)
- # rum (1)
- # shadow-cljs (81)
- # spacemacs (1)
- # specter (33)
- # sql (2)
- # test-check (2)
- # vim (16)
- # yada (11)
(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)But when I call (om/transact this [('add/user ~user) :user/list])
, the user's list get updated
@souenzzo what is d/transact!
?
is that datascript?
@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.
the :value
on mutate does nothing beyond self-documentation
i’m aware that datascript and datomic return mappings of tempids to canonical ids, but i’m not sure how this question is relevant.
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 😛 )
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.
afaik that doesn’t really have anything to do with datascript