Fork me on GitHub
#om
<
2016-07-21
>
ag00:07:39

so for example this:

(ns 'foo
  (:require
   [sablono.core :refer-macros [html]]))

(def css-transition-group (.. js/React -addons -CSSTransitionGroup))

(defcard css-grp
  (om/factory
    (ui
      Object
      (render [this]
        (css-transition-group
          #js {:transitionName "bar" :className "foo"}
          (html [:h1 "Ooompha"]))))))
can anyone tell me how to make it work?

donaldball00:07:54

@anmonteiro: A simple example would be something like:

donaldball00:07:06

(defui Offer
  static om/Ident
  (ident [_ {:keys [offer/id]}]
    [:offer/by-id id])
  static om/IQuery
  (query [_]
    '[:offer/id
      :offer/customer-name]))

donaldball00:07:22

Given my app state contains an offer with a real id, how could I apply a transaction to persist a copy of it to a remote and assign the new id to the extant offer?

ag00:07:20

so I can’t even make something like this work: no sablono this time:

(def css-transition-group (.. js/React -addons -CSSTransitionGroup))

(def data ["Foo" "Bar" "Baz"])

(defcard css-grp
  (om/factory
    (ui
      Object
      (render [this]
        (dom/div nil
          (css-transition-group (clj->js {:transitionName "bar"
                                          :children       (map #(dom/h1 nil %) data)} )))))))

anmonteiro11:07:36

@ag: you need to call js/React.createElement like this:

(js/React.createElement css-transition-group
            #js {:transitionName "bar"
                 :children       (map #(dom/h1 nil %) data)})

anmonteiro11:07:28

@donaldball: I would look at what om.next/default-migrate is doing for tempids and do something similar for your use case

anmonteiro12:07:34

you can even return your mappings from the remote transaction as realid->realid2 as default-migrate doesn’t enforce that keys in the tempid map have to be om tempids

donaldball15:07:43

Thanks, that’s a good idea

donaldball15:07:47

I have a somewhat more elementary question at the moment. Suppose in my state I have an entity of which I have partial information (e.g. the id) and I need to fetch the rest of the data from a remote. Is this a use case for query params?

mattsfrey20:07:53

wondering what tools people are using currently for unit testing / integration testing using cljs and a react wrapper like om or reagent?

donaldball21:07:45

I think I have answered my question from earlier: in the read fn for these data, I can grab the identifiers and smuggle them to the send fn in the ast :params, and it seems to work fine, though I’m not sure if this is a good solution or not

anmonteiro23:07:30

@donaldball: probably how I’d do it too